# HG changeset patch # User Stephanie Marcu # Date 1238075744 -3600 # Node ID f210dce0dc47e695ba2ac8db6e5c85bf1fec9c03 # Parent 936c311010fcdcbf10880a5b36f7f6408ce03591 fix for booelan attribute which have empty string as false value and didn't work if default value for this attribute was True. diff -r 936c311010fc -r f210dce0dc47 web/views/editcontroller.py --- a/web/views/editcontroller.py Thu Mar 26 09:09:58 2009 +0100 +++ b/web/views/editcontroller.py Thu Mar 26 14:55:44 2009 +0100 @@ -166,13 +166,13 @@ self.delete_entities(self.req.edited_eids(withtype=True)) return self.reset() - def _needs_edition(self, rtype, formparams): + def _needs_edition(self, rtype, formparams, entity): """returns True and and the new value if `rtype` was edited""" editkey = 'edits-%s' % rtype if not editkey in formparams: return False, None # not edited value = formparams.get(rtype) or None - if (formparams.get(editkey) or None) == value: + if entity.has_eid() and (formparams.get(editkey) or None) == value: return False, None # not modified if value == INTERNAL_FIELD_VALUE: value = None @@ -183,7 +183,7 @@ attribute described by the given schema if necessary """ attr = rschema.type - edition_needed, value = self._needs_edition(attr, formparams) + edition_needed, value = self._needs_edition(attr, formparams, entity) if not edition_needed: return # test if entity class defines a special handler for this attribute