merge
authorEmile Anclin <emile.anclin@logilab.fr>
Thu, 26 Mar 2009 15:18:48 +0100
changeset 1167 d9865bc720a9
parent 1166 9c5cc3dc2733 (current diff)
parent 1162 f210dce0dc47 (diff)
child 1168 ebf7328c251e
merge
--- a/web/views/editcontroller.py	Thu Mar 26 15:13:54 2009 +0100
+++ b/web/views/editcontroller.py	Thu Mar 26 15:18:48 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