[Checkins] SVN: z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py added an adapter hook to allow for customized ButtonAction objects. Not sure what the best way to test this is.

Paul Carduner paulcarduner at gmail.com
Thu Jun 14 09:42:54 EDT 2007


Log message for revision 76694:
  added an adapter hook to allow for customized ButtonAction objects.  Not sure what the best way to test this is.

Changed:
  U   z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py

-=-
Modified: z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py
===================================================================
--- z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py	2007-06-14 13:39:36 UTC (rev 76693)
+++ z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py	2007-06-14 13:42:53 UTC (rev 76694)
@@ -221,7 +221,12 @@
             if button.condition is not None and not button.condition(self.form):
                 continue
             fullName = prefix + name
-            buttonAction = ButtonAction(self.request, button, fullName)
+            # Look up a button action factory
+            buttonAction = zope.component.queryMultiAdapter(
+                (self.request, button, fullName), interfaces.IFieldWidget)
+            # if one is not found, use the default
+            if buttonAction is None:
+                buttonAction = ButtonAction(self.request, button, fullName)
             # Look up a potential custom title for the action.
             title = zope.component.queryMultiAdapter(
                 (self.form, self.request, self.content, button, self),



More information about the Checkins mailing list