[Checkins] SVN: z3c.form/trunk/src/z3c/form/group. adhere to extractData interface in groups

Adam Groszer agroszer at gmail.com
Fri Mar 27 13:44:39 EDT 2009


Log message for revision 98427:
  adhere to extractData interface in groups
  

Changed:
  U   z3c.form/trunk/src/z3c/form/group.py
  U   z3c.form/trunk/src/z3c/form/group.txt

-=-
Modified: z3c.form/trunk/src/z3c/form/group.py
===================================================================
--- z3c.form/trunk/src/z3c/form/group.py	2009-03-27 17:30:43 UTC (rev 98426)
+++ z3c.form/trunk/src/z3c/form/group.py	2009-03-27 17:44:39 UTC (rev 98427)
@@ -56,12 +56,12 @@
             group.update()
             groups.append(group)
         self.groups = tuple(groups)
-    
-    def extractData(self):
+
+    def extractData(self, setErrors=True):
         '''See interfaces.IForm'''
-        data, errors = super(Group, self).extractData()
+        data, errors = super(Group, self).extractData(setErrors=setErrors)
         for group in self.groups:
-            groupData, groupErrors = group.extractData()
+            groupData, groupErrors = group.extractData(setErrors=setErrors)
             data.update(groupData)
             if groupErrors:
                 if errors:
@@ -87,11 +87,11 @@
 
     groups = ()
 
-    def extractData(self):
+    def extractData(self, setErrors=True):
         '''See interfaces.IForm'''
-        data, errors = super(GroupForm, self).extractData()
+        data, errors = super(GroupForm, self).extractData(setErrors=setErrors)
         for group in self.groups:
-            groupData, groupErrors = group.extractData()
+            groupData, groupErrors = group.extractData(setErrors=setErrors)
             data.update(groupData)
             if groupErrors:
                 if errors:
@@ -115,7 +115,7 @@
                     zope.lifecycleevent.Attributes(interface, *names))
             # Send out a detailed object-modified event
             zope.event.notify(
-                zope.lifecycleevent.ObjectModifiedEvent(content, 
+                zope.lifecycleevent.ObjectModifiedEvent(content,
                     *descriptions))
 
         return changed

Modified: z3c.form/trunk/src/z3c/form/group.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/group.txt	2009-03-27 17:30:43 UTC (rev 98426)
+++ z3c.form/trunk/src/z3c/form/group.txt	2009-03-27 17:44:39 UTC (rev 98427)
@@ -229,7 +229,7 @@
       <div class="error">Required input is missing.</div>
     </li>
   </ul>
-  
+
   >>> print testing.render(add, './/xmlns:fieldset[1]/xmlns:ul')
   <ul>
     <li>
@@ -383,7 +383,7 @@
       <div class="error">Required input is missing.</div>
     </li>
   </ul>
-  
+
   >>> print testing.render(edit, './/xmlns:fieldset/xmlns:ul')
   <ul>
     <li>
@@ -391,7 +391,7 @@
     </li>
   </ul>
 
-When an edit form with groups is successfully committed, a detailed 
+When an edit form with groups is successfully committed, a detailed
 object-modified event is sent out telling the system about the changes.
  To see the error, let's create an event subscriber for object-modified events:
 
@@ -442,7 +442,7 @@
   u'2006'
 
 Let's look at the event:
- 
+
   >>> event = eventlog[-1]
   >>> event
   <zope.lifecycleevent.ObjectModifiedEvent object at ...>
@@ -625,7 +625,7 @@
 
   >>> print testing.render(edit, './/xmlns:i')
   <i>Data successfully updated.</i>
-  
+
 Now the owner object should have updated fields.
 
   >>> reg.owner.firstName
@@ -647,7 +647,7 @@
 Nested Groups
 -----------------
 
-The group can contains groups. 
+The group can contains groups.
 Let's adapt the previous RegistrationEditForm
 
   >>> class OwnerGroup(group.Group):
@@ -703,7 +703,7 @@
 
   >>> print testing.render(edit, './/xmlns:i')
   <i>Data successfully updated.</i>
-  
+
 Now the owner object should have updated fields.
 
   >>> reg.owner.firstName
@@ -751,3 +751,10 @@
 
 
 And that's it!
+
+Just check whether we fully support the interface:
+
+  >>> from z3c.form import interfaces
+  >>> from zope.interface.verify import verifyClass
+  >>> verifyClass(interfaces.IGroup, group.Group)
+  True
\ No newline at end of file



More information about the Checkins mailing list