I changed the IS_EXPR validator to allow the same notation suggested for 
CUSTOM. Can you check?


On Thursday, 14 February 2013 21:04:03 UTC-6, 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