[Zope3-Users] Formlib and invariants
mailinglists at xgm.de
Wed Jul 19 16:18:33 EDT 2006
Am Mittwoch, 19. Juli 2006 03:25 schrieb Darryl Cousins:
> Hi All,
> I've had a bit of a struggle getting formlib error views to play nicely
> with invariants. That is the problem I have found to trouble me is in
> the zope.formlib.form.FormBase method error_views.
> When I use the schema:
> class IMemberRegisterForm(IMemberData, IMemberDetails):
> """Schema for a member register form."""
> new_password = Password(
> title=_("Choose a Password"),
> verify_password = Password(
> title=_("Verify Password"),
> def passwordsMatch(register):
> if register.new_password != register.verify_password:
> msg = _("Entered passwords do not match")
> error = ('verify_password', _("Passwords"), msg)
> raise Invalid(error)
I am not sure if I've understood you correctly, but I've solved the same
problem (raise error if passwords are not equal) this way:
"""The passwords are not equal."""
"""For entering the data for registration."""
password = Password(title=u"Password",
password2 = Password(title=u"Verify Password",
if obj.password != obj.password2:
Hope this helps,
More information about the Zope3-users