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.

Gary
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to