Chained validators again

Andrea Riciputi <[email protected]> Fri, 6 Mar 2009 16:59:13 +0100
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Hi,
I'm still having some issues with chained validators. Despite what  
mentioned in the documentation, chained_validators **doesn't** always  
allow for multiple validators to fail.

In fact the example in the documentation works as expected, but the  
following one doesn't:

class Foo(Schema):
     filter_extra_fields = True
     allow_extra_fields = True
     a = String()
     b = String()
     c = String()
     d = String()
     chained_validators = [
             RequireIfPresent('a', present='b'),
             RequireIfPresent('c', present='d'),
             ]
     pass

foo = Foo()

try:
     foo.to_python({'a':'', 'b':'bb', 'c':'', 'd':'dd'})
except fe.Invalid, err:
     print err.error_dict

{'a': Invalid(u'Please enter a value',)}

whilst I'd have expected two error messages since both 'a' and 'c'  
fields are missing! Could you explain me why this happens, and how I  
can get all the chained validators actually evaluated?

Cheers,
  Andrea

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H