[Checkins] SVN: z3c.form/trunk/ I'm sorry I need to revert some changes around updateWidgets. It just breaks too many high level tests. I'm sure it would break for others too.

Adam Groszer cvs-admin at zope.org
Tue Nov 27 09:34:36 UTC 2012


Log message for revision 128436:
  I'm sorry I need to revert some changes around updateWidgets. It just breaks too many high level tests. I'm sure it would break for others too.
  The way to change the widgets prefix would be to override updateWidgets:
  super(MyForm, self).updateWidgets('myprefix')

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

-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2012-11-25 12:39:34 UTC (rev 128435)
+++ z3c.form/trunk/CHANGES.txt	2012-11-27 09:34:35 UTC (rev 128436)
@@ -5,26 +5,22 @@
 2.10.0 (unreleased)
 -------------------
 
-- Initialize widgets in ``update`` step. The ``updateWidgets`` method
-  is now responsible only for actually updating the widgets.
+- The ``updateWidgets`` method has learned an argument
+  ``prefix`` which allows setting the prefix of the field widgets
+  adapter.
 
   This allows updating the common widgets prefix before the individual
   widgets are updated, useful for situations where neither a form, nor
   a widgets prefix is desired.
 
-  In addition, the ``updateWidgets`` method has learned an argument
-  ``prefix`` which allows setting the prefix of the field widgets
-  adapter.
-
 - Capitalize the messages 'no value' and 'select a value'. This change
-  has been applied also to the existing translations (where
-  applicable).
+  has been applied also to the existing translations (where applicable).
 
-- `TextLinesConverter`: do not ignore newlines at the end of the inputted
+- ``TextLinesConverter``: do not ignore newlines at the end of the inputted
   string, thus do not eat blank items
 
-- `TextLinesConverter`: toFieldValue, convert conversion exceptions to
-  `FormatterValidationError`, for cases like got a string instead of int
+- ``TextLinesConverter``: toFieldValue, convert conversion exceptions to
+  ``FormatterValidationError``, for cases like got a string instead of int
 
 2.9.0 (2012-09-17)
 ------------------

Modified: z3c.form/trunk/src/z3c/form/form.py
===================================================================
--- z3c.form/trunk/src/z3c/form/form.py	2012-11-25 12:39:34 UTC (rev 128435)
+++ z3c.form/trunk/src/z3c/form/form.py	2012-11-27 09:34:35 UTC (rev 128436)
@@ -123,6 +123,8 @@
 
     def updateWidgets(self, prefix=None):
         '''See interfaces.IForm'''
+        self.widgets = zope.component.getMultiAdapter(
+            (self, self.request, self.getContent()), interfaces.IWidgets)
         if prefix is not None:
             self.widgets.prefix = prefix
         self.widgets.mode = self.mode
@@ -145,8 +147,6 @@
 
     def update(self):
         '''See interfaces.IForm'''
-        self.widgets = zope.component.getMultiAdapter(
-            (self, self.request, self.getContent()), interfaces.IWidgets)
         self.updateWidgets()
 
     def render(self):

Modified: z3c.form/trunk/src/z3c/form/group.py
===================================================================
--- z3c.form/trunk/src/z3c/form/group.py	2012-11-25 12:39:34 UTC (rev 128435)
+++ z3c.form/trunk/src/z3c/form/group.py	2012-11-27 09:34:35 UTC (rev 128436)
@@ -34,6 +34,8 @@
 
     def updateWidgets(self, prefix=None):
         '''See interfaces.IForm'''
+        self.widgets = zope.component.getMultiAdapter(
+            (self, self.request, self.getContent()), interfaces.IWidgets)
         for attrName in ('mode', 'ignoreRequest', 'ignoreContext',
                          'ignoreReadonly'):
             value = getattr(self.parentForm.widgets, attrName)
@@ -44,7 +46,7 @@
 
     def update(self):
         '''See interfaces.IForm'''
-        super(Group, self).update()
+        self.updateWidgets()
         groups = []
         for groupClass in self.groups:
             # only instantiate the groupClass if it hasn't already
@@ -121,10 +123,9 @@
 
         return changed
 
-    def updateWidgets(self, prefix=None):
+    def update(self):
         '''See interfaces.IForm'''
-        super(GroupForm, self).updateWidgets(prefix=prefix)
-
+        self.updateWidgets()
         groups = []
         for groupClass in self.groups:
             # only instantiate the groupClass if it hasn't already
@@ -136,3 +137,5 @@
             group.update()
             groups.append(group)
         self.groups = tuple(groups)
+        self.updateActions()
+        self.actions.execute()



More information about the checkins mailing list