Issue #114 resolved

Setting property of mapped object to 0 fails

Juraj Variny
created an issue

Anytime user wants to use sqla-enabled form to set mapped object property to (integer) 0, the value is treated as None and completely ignored. The problem should be fixed by following or similar patch.

Maybe it is also necessary to patch for another types, for example Decimal(0) evaluates to False too. {{{

!python

--- utils.py.2.0.4 2012-07-03 01:38:21.000000000 +0200 +++ utils.py 2012-07-03 01:49:34.000000000 +0200 @@ -34,9 +34,9 @@ protect_prm_tamp=protect_prm_tamp ) elif key not in pk_props: - if value or type(value) == bool: + if value or type(value) in (bool,int): # Ignore None and '', but we do want to explicitly - # set 'False' if its a boolean. + # set 'False' or '0' if its a boolean/integer. setattr(obj, key, value) else: pass }}}

Comments (2)

  1. Log in to comment