Em Segunda 17 Abril 2006 06:48, Andrew Grover escreveu:

> I want to catch a form with formencode if an "old password" field
> doesn't match a field from the DB. How do I do this? validators don't
> seem to be able to take arguments at runtime, so I don't seem to be
> able to write a validator for this purpose.

You can take a look at turbogears/validators.py to see how to write one.  Your 
logic will reside on the "_to_python" part.  This will make it know what to 
do to convert -- or accept -- the value you passed from somewhere (your web 
interface here) to a Python object.

Take a look at the Money validator and you'll also see how to abort with an 
error when you find an incorrect value.

--
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to