[Zope3-dev] WidgetInputError and support for multiple errors

Jim Fulton jim at zope.com
Mon Sep 27 17:11:54 EDT 2004


Garrett Smith wrote:
> WidgetInputError appears to be an aggregator for multiple errors.
> However, I can't find instances in the code where multiple errors are
> ever actually aggregated. In all cases that I've seen, either a single
> error is wrapped, or the client code mistakenly passes a string message
> as the error argument.
> 
> WidgetsError exists, which is an aggregator used by forms to convey all
> of the errors on a form, but this isn't applicable to individual
> widgets.

Yup

> It's not obvious to me why one would need support for multiple errors
> for a widget. Any input here?

Multiple schema invariants involving a field are violated.

(Are schema invariants checked today?)

> I'd like to change WidgetInputError to:
> 
>   class IWidgetInputError(Interface):
>     widget = Attribute("The widget the error is associated with.")
>     message = Attribute("An error message to display to the user.")
>     original = Attribute("An optional original error that caused the
> input error.")
> 
>   class WidgetInputError(UserError):
>     def __init__(self, widget, message, original=None):
>        self.widget = widget
>        self.message = message
>        self.original = original
> 
> The doc() method would be deprecated.

Yeah. Is it used for anything?

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list