Hello,
I am still working on learning the inner workings of web2py. At the moment I am
playing with custom validators. I have unfortunately been unable to figure out
how to get a meaningful error message returned to the user.
Here is my custom validator.
class IS_VALID_A(object):
Name = 'IS_VALID_A'
def __init__(self, object, error_message='Invalid Domain Name'):
self.error_message = error_message
self.d = object
self.DEBUG = 'YES'
def __call__(self, value):
if self.checkrecord(value) == 'valid':
return (value, None)
else:
return (value, (self.error_message))
def checkrecord(self, data):
value = 'invalid'
return value
In theory that should always error and give me a message saying 'Invalid Domain
Name'. Unfortunately I just get the database table name back in the error. Is
that by design? I can't seem to find any documentation that outlines how to get
a human readable error back. Any advice would be really appreciated.
Regards,
Jimmy.
--