[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/source.py Bug fix:

Benji York benji at zope.com
Fri Feb 11 14:28:19 EST 2005


Log message for revision 29120:
  Bug fix:
   - Missing imports.
   - Copy-paste error.
   - Added XXX for several untested code paths (which lead to the bugs).
  

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/source.py

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.py	2005-02-11 19:04:40 UTC (rev 29119)
+++ Zope3/trunk/src/zope/app/form/browser/source.py	2005-02-11 19:28:19 UTC (rev 29120)
@@ -23,8 +23,9 @@
 import zope.app.form.browser.widget
 import zope.app.form.browser.interfaces
 from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.form.interfaces import WidgetInputError, MissingInputError
+from zope.app.form.browser.interfaces import IWidgetInputErrorView
 
-
 class SourceDisplayWidget(zope.app.form.Widget):
 
     def __init__(self, field, source, request):
@@ -137,6 +138,7 @@
 
     def error(self):
         if self._error:
+            # XXX This code path is untested.
             return zapi.getViewProviding(self._error, IWidgetInputErrorView,
                                          self.request).snippet()
         return ""
@@ -240,6 +242,7 @@
 
         if token is None:
             if field.required:
+                # XXX This code path is untested.
                 raise zope.app.form.interfaces.MissingInputError(
                     field.__name__, self.label,
                     )
@@ -248,6 +251,7 @@
         try:
             value = self.terms.getValue(str(token))
         except LookupError:
+            # XXX This code path is untested.
             err = zope.schema.interfaces.ValidationError(
                 "Invalid value id", token)
             raise WidgetInputError(field.__name__, self.label, err)
@@ -258,6 +262,7 @@
         try:
             field.validate(value)
         except ValidationError, err:
+            # XXX This code path is untested.
             self._error = WidgetInputError(field.__name__, self.label, err)
             raise self._error
 
@@ -425,9 +430,11 @@
         # Remaining code copied from SimpleInputWidget
 
         # value must be valid per the field constraints
+        field = self.context
         try:
-            self.context.validate(value)
+            field.validate(value)
         except ValidationError, err:
+            # XXX This code path is untested.
             self._error = WidgetInputError(field.__name__, self.label, err)
             raise self._error
 



More information about the Zope3-Checkins mailing list