>>> IS_EMAIL()('somethingwrong')
('somethingwrong', <lazyT 'enter a valid email address'>)

when the returned tuple contains a second element which is != None, it is an
error message and validador returned 'invalid'

>>> IS_EMAIL()('[email protected]')
('[email protected]', None)
>>>

when the second element is None, it means that validador returned valid

so you can use this outside db with any kind of value.

>>> if IS_EMAIL()('somethingwrong')[1]: print "Invalid email"
...
Invalid email





--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]



On Thu, Jun 2, 2011 at 5:45 PM, pbreit <[email protected]> wrote:

> Is there a generic way of using validators outside a database context?

Reply via email to