Hi,

here's source:

import formencode
from formencode.validators import *
from webhelpers.util import UnicodeMultiDict

class Form(formencode.Schema):
    allow_extra_fields = True
    create = Bool()
    email = Email(if_missing=None)
    test = String(if_missing=None)

    chained_validators = [
            RequireIfPresent('email', present='create'),
            RequireIfPresent('test', present='test'),
            ]

f = Form()

data = {'create': True}
f.to_python(data)

And here's output:
...
  File "/usr/lib/python2.5/site-packages/FormEncode-1.2.1-py2.5.egg/
formencode/validators.py", line 2651, in _to_python
    'empty', state), value, state)})
formencode.api.Invalid: You must give a value for email

And my question: is it possible to print all validation errors in this
case? ('test' value is needed here too, but message about this will be
print if email will be all right).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to