[Checkins] SVN: z3c.form/trunk/ Clarify MultiWidget.extract(), when there are zero items, this is now [] instead of <NO_VALUE>

Adam Groszer agroszer at gmail.com
Tue May 3 06:56:19 EDT 2011


Log message for revision 121520:
  Clarify MultiWidget.extract(), when there are zero items, this is now [] instead of <NO_VALUE>

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

-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2011-05-03 06:59:19 UTC (rev 121519)
+++ z3c.form/trunk/CHANGES.txt	2011-05-03 10:56:18 UTC (rev 121520)
@@ -5,6 +5,11 @@
 2.4.3 (unreleased)
 ------------------
 
+- Clarify MultiWidget.extract(), when there are zero items,
+  this is now [] instead of <NO_VALUE>
+
+- Some typos fixed
+
 - Fixed test failure due to change in floating point representation in Python
   2.7.
 

Modified: z3c.form/trunk/src/z3c/form/widget.py
===================================================================
--- z3c.form/trunk/src/z3c/form/widget.py	2011-05-03 06:59:19 UTC (rev 121519)
+++ z3c.form/trunk/src/z3c/form/widget.py	2011-05-03 10:56:18 UTC (rev 121520)
@@ -270,7 +270,7 @@
 
     @apply
     def mode():
-        """This invokes updateWidgets on any value change e.g. update/extract."""
+        """This sets the subwidgets modes."""
         def get(self):
             return self._mode
         def set(self, mode):
@@ -415,9 +415,6 @@
         for idx in range(counter):
             widget = self.getWidget(idx)
             append(widget.value)
-        if len(values) == 0:
-            # no multi value found
-            return interfaces.NO_VALUE
         return values
 
 

Modified: z3c.form/trunk/src/z3c/form/widget.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/widget.txt	2011-05-03 06:59:19 UTC (rev 121519)
+++ z3c.form/trunk/src/z3c/form/widget.txt	2011-05-03 10:56:18 UTC (rev 121520)
@@ -549,11 +549,13 @@
   >>> multiWidget.extract()
   <NO_VALUE>
 
-If we provide an empty counter we will get no value:
+If we provide an empty counter we will get an empty list.
+This is accordance with Widget.extract(), where a missing request value
+is <NO_VALUE> and an empty ('') request value is ''.
 
   >>> multiWidget.request = TestRequest(form={'multi.name.count':'0'})
   >>> multiWidget.extract()
-  <NO_VALUE>
+  []
 
 If we provide real values within the request, we will get it back:
 
@@ -571,8 +573,8 @@
   >>> multiWidget.extract()
   [u'bad']
 
-Storing a widget value forces to update the (sub) widgets. this forces also to
-validate the (sub) widget values. For showing this we nee dot register a
+Storing a widget value forces to update the (sub) widgets. This forces also to
+validate the (sub) widget values. To show this we need to register a
 validator:
 
   >>> from z3c.form.validator import SimpleFieldValidator



More information about the checkins mailing list