Question about chained validators

Andrea Riciputi <[email protected]> Sun, 19 Apr 2009 23:26:06 +0200
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Hi all,
I've noticed that a chained validator with validate_partial_form=True  
is called twice. The first time its .validate_partial() method is  
called (which in turn calls .validate_python()),  
then .validate_python() is called directly.

The problem is that the second time the input has been already  
converted and the validators could fails (e.g. if the input string has  
been converted into a datetime object).

Probably I haven't understood how to get this kind of validators to  
work properly. I usually define them like this:

class Foo(FancyValidator):
    validate_partial_form = True
     messages = {
             'message_key' : u"the message"
             }

     def validate_partial(self, values, state):
         self.validate_python(values, state)

     def validate_python(self, values, state):
	...actual validating code here...
	...raise Invalid in case...

Can anyone explain me why I get this wrong?

TIA,
  Andrea

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p