I'm trying to use a compound validator but seem to be a little
confused.  Here's a simple example:

>>> x = All(Int(), OneOf([1,2,3]))
>>> x.to_python('1')
. remainder of traceback removed .
formencode.api.Invalid: Value must be one of: 1; 2; 3 (not '1')

This is a little confusing.  After digging through the code it looks
like Compound validators run the conversion *backwards*, so OneOf gets
'1' before Int has a chance to convert it to an integer.
I'm sure there is a logical reason for this.  Could someone enlighten
me.

BTW.  is there a reason turbogears.validators doesn't include:
  from formencode.compound import *


-- 
DS

Reply via email to