[Checkins] SVN: z3c.form/trunk/ Initialize the field widget manager in the update-step, such that the widget update step is only responsible for actually updating the widgets. The change is required to support the situation where you want to change the common widget prefix (which defaults to 'widgets.').

Malthe Borch cvs-admin at zope.org
Wed Sep 12 11:52:09 UTC 2012


Log message for revision 127831:
  Initialize the field widget manager in the update-step, such that the widget update step is only responsible for actually updating the widgets. The change is required to support the situation where you want to change the common widget prefix (which defaults to 'widgets.').

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-09-12 10:17:42 UTC (rev 127830)
+++ z3c.form/trunk/CHANGES.txt	2012-09-12 11:52:05 UTC (rev 127831)
@@ -2,6 +2,16 @@
 CHANGES
 =======
 
+In next release ...
+
+- Initialize widgets in ``update`` step. The ``updateWidgets`` method
+  is now responsible only for actually updating the widgets.
+
+  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.
+
+
 2.8.3 (unreleased)
 ------------------
 

Modified: z3c.form/trunk/src/z3c/form/form.py
===================================================================
--- z3c.form/trunk/src/z3c/form/form.py	2012-09-12 10:17:42 UTC (rev 127830)
+++ z3c.form/trunk/src/z3c/form/form.py	2012-09-12 11:52:05 UTC (rev 127831)
@@ -126,8 +126,6 @@
 
     def updateWidgets(self):
         '''See interfaces.IForm'''
-        self.widgets = zope.component.getMultiAdapter(
-            (self, self.request, self.getContent()), interfaces.IWidgets)
         self.widgets.mode = self.mode
         self.widgets.ignoreContext = self.ignoreContext
         self.widgets.ignoreRequest = self.ignoreRequest
@@ -148,6 +146,8 @@
 
     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-09-12 10:17:42 UTC (rev 127830)
+++ z3c.form/trunk/src/z3c/form/group.py	2012-09-12 11:52:05 UTC (rev 127831)
@@ -34,8 +34,6 @@
 
     def updateWidgets(self):
         '''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 +42,7 @@
 
     def update(self):
         '''See interfaces.IForm'''
-        self.updateWidgets()
+        super(Group, self).update()
         groups = []
         for groupClass in self.groups:
             # only instantiate the groupClass if it hasn't already
@@ -121,9 +119,10 @@
 
         return changed
 
-    def update(self):
+    def updateWidgets(self):
         '''See interfaces.IForm'''
-        self.updateWidgets()
+        super(GroupForm, self).updateWidgets()
+
         groups = []
         for groupClass in self.groups:
             # only instantiate the groupClass if it hasn't already
@@ -135,7 +134,3 @@
             group.update()
             groups.append(group)
         self.groups = tuple(groups)
-        self.updateActions()
-        self.actions.execute()
-        if self.refreshActions:
-            self.updateActions()



More information about the checkins mailing list