Quoting george hu (2012-05-22 23:34:30)
> I have the following deferred validator:
> @colander.deferred
> def deferred_password_validator(node, kw):
>     password = kw.get('password')
>     re_password = kw.get('re_password')
>     if password != re_password:
>         raise colander.Invalid(node, 'Password did not match confirm')
> 
> Then I try to capture the exception:
> try:
>   form.validate(....)
> except ValidationFailure, e:
>   error_dict = e.error.asdict()
>                 
> 
> However when the program runs, it just breaks into terminal, showing:
> Invalid: {'re_password': 'Password did not match confirm'}
> 
> Can anybody help me to see where is the problem?
> 
> Thanks

I have two questions:
Why do you use a deferred for that kind of validation? A simple validation
function should be more than enough.
Besides that, do you know Deform already provides such validation? See [1]

Mariano

[1] http://deformdemo.repoze.org/checkedpassword/

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to