[Zope3-Users] Formlib and invariants?
Bernd Dorn
zope-mailinglist at mopa.at
Thu May 4 07:44:08 EDT 2006
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
> Gary
More information about the Zope3-users
mailing list