[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Forms - Utility.py:1.9

Jim Fulton jim@zope.com
Sun, 22 Dec 2002 16:25:42 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms
In directory cvs.zope.org:/tmp/cvs-serv8024/lib/python/Zope/App/Forms

Modified Files:
	Utility.py 
Log Message:
Changed the getWidgetsData and getWidgetsDataForContent utility
functions to allow missing data for non-req1uired fields.


=== Zope3/lib/python/Zope/App/Forms/Utility.py 1.8 => 1.9 ===
--- Zope3/lib/python/Zope/App/Forms/Utility.py:1.8	Thu Dec 19 14:50:00 2002
+++ Zope3/lib/python/Zope/App/Forms/Utility.py	Sun Dec 22 16:25:11 2002
@@ -169,8 +169,9 @@
     The data are returned in a mapping from field name to value.
 
     If the required argument is true, then all of the data defined by
-    the schema will be returned. If some data are missing from the
-    input, an error will be raised.
+    the schema will be returned. If some required data are missing
+    from the input, an error will be raised.
+
     """
 
     result = {}
@@ -186,7 +187,7 @@
                     result[name] = widget.getData()
                 except Exception, v:
                     errors.append(v)
-            elif required:
+            elif required and field.required:
                 raise MissingInputError(
                     widget.name, widget.title, name)
 
@@ -205,8 +206,10 @@
     The data are assigned to the given content object.
 
     If the required argument is true, then all of the data defined by
-    the schema will be set. If some data are missing from the
-    input, an error will be raised.
+    the schema will be set, at least for required fields. If some data
+    for required fields are missing from the input, an error will be
+    raised.
+    
     """
     
     data = getWidgetsData(view, schema, required, names)