[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - widget.py:1.10

Marius Gedminas mgedmin@codeworks.lt
Mon, 20 Jan 2003 11:24:10 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv4892/src/zope/app/browser/form

Modified Files:
	widget.py 
Log Message:
IntWidget and FloatWidget should not try to access context.min_length which
is not valid for IInt/IFloat fields.  Added a fix and unit tests for the bug.
Introduced _FieldFactory in BrowserWidgetTest to facilitate widget testing
with different kinds of fields.




=== Zope3/src/zope/app/browser/form/widget.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.9	Thu Jan 16 14:50:28 2003
+++ Zope3/src/zope/app/browser/form/widget.py	Mon Jan 20 11:23:37 2003
@@ -182,13 +182,13 @@
         v = self.request.form.get(self.name)
         if v is None:
             return 0
-        if not v and self.context.min_length > 0:
+        if not v and getattr(self.context, 'min_length', 1) > 0:
             return 0
         return 1
 
     def _convert(self, value):
         v = self.request.form.get(self.name)
-        if not v and self.context.min_length > 0:
+        if not v and getattr(self.context, 'min_length', 1) > 0:
             return None
         return v