[Zope3-dev] WidgetInputError and support for multiple errors

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


Jim Fulton wrote:
> errors
> 
> 
> Garrett Smith wrote:
>> Jim Fulton wrote:
>> 
>> 
>>> Garrett Smith wrote:
>>> 
>>>> 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 dont believe so -- I haven't seen anything like that. The widget
>> merely calls the field's validate method, which only raises a single
>> error.
> 
> But in the future we will.  We'll probably need to say that we only
> check schema invariants of all of the field constraints are met.  I
> could easily imagine multiple invariants involving the same field and
> wanting to show the messages for them next to the field.
> 
> Jim

Okay -- so, you're okay with the following:

  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 IWidget(Interface):
    ...
    errors = Attribute("A list of errors generated by the last call to
                 getInputValue.")
    ...

 -- Garrett


More information about the Zope3-dev mailing list