[Zope3-dev] WidgetInputError and support for multiple errors

Garrett Smith garrett at mojave-corp.com
Mon Sep 27 17:10:22 EDT 2004


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.

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

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.

The classes MissingInputError and ConversionError would subclass
WidgetInputError.

I"m working on a proposal here:

  http://dev.zope.org/Zope3/MoreCleanupOfWidgets

which I'll update based on feedback to this post.

 --Garrett


More information about the Zope3-dev mailing list