[Checkins] SVN: plone.z3cform/trunk/ handle changed extract method signature in z3c.form > 1.9.0 ... I'd be happy for a more elegant suggestion

David Glick davidglick at onenw.org
Sat Dec 6 01:16:55 EST 2008


Log message for revision 93714:
  handle changed extract method signature in z3c.form > 1.9.0 ... I'd be happy for a more elegant suggestion

Changed:
  U   plone.z3cform/trunk/docs/HISTORY.txt
  U   plone.z3cform/trunk/plone/z3cform/widget.py

-=-
Modified: plone.z3cform/trunk/docs/HISTORY.txt
===================================================================
--- plone.z3cform/trunk/docs/HISTORY.txt	2008-12-06 00:36:57 UTC (rev 93713)
+++ plone.z3cform/trunk/docs/HISTORY.txt	2008-12-06 06:16:54 UTC (rev 93714)
@@ -4,6 +4,9 @@
 0.5.3 - unreleased
 ------------------
 
+* Handle changed signature for widget extract method in z3c.form > 1.9.0
+  [davisagli]
+
 * Added wildcard support to the 'before' and 'after' parameters of the
   fieldset 'move' utility function.
   [davisagli]

Modified: plone.z3cform/trunk/plone/z3cform/widget.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/widget.py	2008-12-06 00:36:57 UTC (rev 93713)
+++ plone.z3cform/trunk/plone/z3cform/widget.py	2008-12-06 06:16:54 UTC (rev 93714)
@@ -24,13 +24,17 @@
                 ))
         return self.terms
 
-    def extract(self, default=z3c.form.interfaces.NOVALUE):
+    def extract(self, default=z3c.form.interfaces.NOVALUE, setErrors=True):
         # The default implementation returns [] here.
         if (self.name not in self.request and
             self.name+'-empty-marker' in self.request):
             return default
         else:
-            return super(SingleCheckboxWidget, self).extract(default)
+            try:
+                return super(SingleCheckboxWidget, self).extract(default, setErrors=setErrors)
+            except TypeError:
+                # for z3c.form <= 1.9.0
+                return super(SingleCheckboxWidget, self).extract(default)
 
 @interface.implementer(z3c.form.interfaces.IDataConverter)
 def singlecheckboxwidget_factory(field, request):



More information about the Checkins mailing list