[Zope3-Users] Formlib and invariants?

Gary Poster gary at zope.com
Thu May 4 21:15:55 EDT 2006


On May 4, 2006, at 7:44 AM, Bernd Dorn wrote:

>
> On 04.05.2006, at 13:35, Gary Poster wrote:
>
>>
>> On May 3, 2006, at 11:51 PM, Bernd Dorn wrote:
>>
>>> yes, this should really be fixed up in the default implementation  
>>> of formlib
>>>
>>> because interface.Invalid has no registered multiadapter to
>>>  zope.app.form.browser.interfaces.IWidgetInputErrorView
>>>
>>> you have to raise a WidgetInputError
>>>
>>> an example for such an error:
>>>
>>> from zope.schema import Datetime,Bool,ValidationError
>>> from zope.app.form.interfaces import IWidgetInputError
>>>
>>> class FromGreaterThanTo(ValidationError):
>>>     u"""From-Date is after To-Date"""
>>>
>>>     # this is needed to adapt to a view for formlib
>>>     implements(IWidgetInputError)
>>
>> Well, you can raise any error from an invariant that  
>> extends...zope.interface.Invalid, maybe?  The invariant interface  
>> says what is allowed somewhere in zope.interface.
>>
>> ...I suppose we could have a generic view for Invalid errors that  
>> simply said "This is invalid, try again"?  Doesn't seem very  
>> useful to me.
>>
>> You are responsible for making sure you have a reasonable  
>> exception view of an exception you raise.  I'm inclined to think  
>> that this is a documentation bug at worst.
>>
>
> yes, because in form.txt Invalid is used directly, wich implies  
> that this should work

Would you mind putting in a collector issue for this?

Thanks

Gary


More information about the Zope3-users mailing list