I like the idea of including the ANY and CUSTOM validators (we don't need 
ALL, though, right? -- that's the default behavior for a list of 
validators).

Anthony

On Thursday, February 14, 2013 10:04:03 PM UTC-5, rochacbruno wrote:
>
> It gives me the idea of a CUSTOM validator
>
>
> class CUSTOM(object):
>     def __init__(self, function):
>         self.function = function
>
>     def __call__(self, value):
>         # the function should return the error_message or None
>         return(value, self.function(value))
>
>
> So the use should be:
>
> def my_validator_function(value):
>      # do anything
>      return "error message" or None
>
> db.table.field.requires = CUSTOM(my_validator_function)
>
> So, it works the same as onvalidation but can be applied in models.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to