[Zope3-dev] Formlib error handling

Gary Poster gary at zope.com
Thu May 18 17:36:42 EDT 2006


On May 18, 2006, at 4:12 PM, <dev at projekt01.ch> wrote:

> Hi Gary
>
> [...]
>> With your change, if the error is (or extends!) Invalid, it
>> is hardcoded to assume the first argument is a string,
>> message, or something with a reasonably __str__, translate if
>> it is a message, and wrap the result with a <span>.  I'd much
>> prefer it if that code were ripped out of error_views and
>> made, simply, into a view for (Invalid, IBrowserRequest),
>> perhaps even registered by the formlib zcml.  Do you see any
>> issue with that?
>
> No, that's a good idea. btw, I can also live without the
> additional span tag arround the message string. Do you
> have time to change this?

Heh, not right now.  Maybe next week.

>> Also, I don't love the 'widget_title' stuff in error_views: that
>> seems to me to be the responsibility of the error view.    Is that
>> new?  What's the rationale?
>
> No, this was a existing part. I agree, we sould move this part to
> the error view, if possible.

Hm.  I wonder who did this then.  Maybe I'll poke around. :-)

>>> 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.
>>
>> This is the place in the code that knows the widget name and
>> label, so it's not unreasonable.
>
> What do you mean by this? Is it correct how I converted
> ValidationError to useable widget input errors?

Sorry for being unclear.

What you did makes sense.  I have intuitive reservations that I am  
discounting because I cannot rationalize them.  Therefore, +1 to what  
you did.

Gary


More information about the Zope3-dev mailing list