I guess the first one is wrong.. to amtch your criteria I think you need
this
class ANY(object):
def __init__(self, validators):
self.validators = validators
def __call__(self, value):
# validates the value against each validator
results = [validator(value)[1] for validator in self.validators]
# check if there is
if not all(results):
# invalid, so return the first error message
return (value, [result for result in results if result])
else:
# all valid
return (value, None)
db.table.somefield.requires = ANY([IS_EMAIL(), IS_MATCH(), IS_NOT_EMPTY()])
--
---
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.