[Zope3-checkins] SVN: Zope3/trunk/src/zope/formlib/form.py Fix error handling, please double check this!

Roger Ineichen roger at projekt01.ch
Sat Apr 22 19:11:42 EDT 2006


Log message for revision 67278:
  Fix error handling, please double check this!
  
  The formlib.form.EditForm doesn't handle ValidationError in the
  method error_views. 
  I converted ValidationError to WidgetInputError in the method 
  getWidgetsData which is responsible to catch errors raised by
  the widget getInputValue method.

Changed:
  U   Zope3/trunk/src/zope/formlib/form.py

-=-
Modified: Zope3/trunk/src/zope/formlib/form.py
===================================================================
--- Zope3/trunk/src/zope/formlib/form.py	2006-04-22 19:05:32 UTC (rev 67277)
+++ Zope3/trunk/src/zope/formlib/form.py	2006-04-22 23:11:42 UTC (rev 67278)
@@ -30,6 +30,7 @@
 from zope.interface.interface import InterfaceClass
 import zope.interface.interfaces
 from zope.schema.interfaces import IField
+from zope.schema.interfaces import ValidationError
 import zope.security
 
 import zope.app.container.interfaces
@@ -316,6 +317,10 @@
 
             try:
                 data[name] = widget.getInputValue()
+            except ValidationError, error:
+                # convert field ValidationError to WidgetInputError
+                error = WidgetInputError(widget.name, widget.label, error)
+                errors.append(error)
             except InputErrors, error:
                 errors.append(error)
 



More information about the Zope3-Checkins mailing list