[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/form/browser/add.py Merged revision 41734 from the trunk:

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


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

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

-=-
Modified: Zope3/branches/3.2/src/zope/app/form/browser/add.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/form/browser/add.py	2006-02-21 15:35:16 UTC (rev 41736)
+++ Zope3/branches/3.2/src/zope/app/form/browser/add.py	2006-02-21 15:35:37 UTC (rev 41737)
@@ -115,11 +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:



More information about the Zope3-Checkins mailing list