[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/add.py Initialized values are not overwritten by 'None' if there is no input for a data field.

Egon Frerich e.frerich at nord-com.net
Tue Feb 21 10:31:48 EST 2006


Log message for revision 41734:
  Initialized values are not overwritten by 'None' if there is no input for a data field.

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/add.py

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/add.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/add.py	2006-02-21 15:23:02 UTC (rev 41733)
+++ Zope3/trunk/src/zope/app/form/browser/add.py	2006-02-21 15:31:48 UTC (rev 41734)
@@ -115,12 +115,12 @@
             adapted = self.schema(content)
             for name in self._set_after_add:
                 if name in data:
-                    field = self.schema[name]
-                    try:
-                        field.set(adapted, data[name])
-                    except ValidationError:
-                        errors.append(sys.exc_info()[1])
-
+                    if data[name] <> None:
+                        field = self.schema[name]
+                        try:
+                            field.set(adapted, data[name])
+                        except ValidationError:
+                            errors.append(sys.exc_info()[1])
             # We have modified the object, so we need to publish an
             # object-modified event:
             description = Attributes(self.schema, *self._set_after_add)



More information about the Zope3-Checkins mailing list