[Checkins] SVN: z3c.form/trunk/ - Bug: Prevent to call __len__ on ITerms and use ``is None`` for check for

Roger Ineichen roger at projekt01.ch
Mon Apr 21 11:29:08 EDT 2008


Log message for revision 85532:
  - Bug: Prevent to call __len__ on ITerms and use ``is None`` for check for 
    existence. Because __len__ is not a part of the ITerms API and 
    ``not widget.terms`` will end in calling __len__ on existing terms.
  - Update CHANGES.txt

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

-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2008-04-21 15:17:59 UTC (rev 85531)
+++ z3c.form/trunk/CHANGES.txt	2008-04-21 15:29:08 UTC (rev 85532)
@@ -2,6 +2,13 @@
 CHANGES
 =======
 
+Version 1.8.2dev (unreleased)
+-----------------------------
+
+- Bug: Prevent to call __len__ on ITerms and use ``is None`` for check for 
+  existence
+
+
 Version 1.8.1 (2008-04-08)
 --------------------------
 

Modified: z3c.form/trunk/src/z3c/form/converter.py
===================================================================
--- z3c.form/trunk/src/z3c/form/converter.py	2008-04-21 15:17:59 UTC (rev 85531)
+++ z3c.form/trunk/src/z3c/form/converter.py	2008-04-21 15:29:08 UTC (rev 85532)
@@ -275,14 +275,14 @@
     def toWidgetValue(self, value):
         """Convert from Python bool to HTML representation."""
         widget = self.widget
-        if not widget.terms:
+        if widget.terms is None:
             widget.updateTerms()
         return [widget.terms.getTerm(entry).token for entry in value]
 
     def toFieldValue(self, value):
         """See interfaces.IDataConverter"""
         widget = self.widget
-        if not widget.terms:
+        if widget.terms is None:
             widget.updateTerms()
         collectionType = self.field._type
         if isinstance(collectionType, tuple):



More information about the Checkins mailing list