> Fran, the following validator seems to work as per your needs:
This looks really nice - many thanks!
Also looks generic enough to be worth including in Web2Py core
[Although I'm wondering whether it could still be worth adding the
ability to package custom validators within an application to keep
them portable. I guess the modules directory could be used for this so
having a 'validators_custom.py' in that folder which gets hooked in
sounds useful to me...]
However if I put this into my db.py it fails:
Traceback (most recent call last):
File "C:\Bin\web2py\gluon\restricted.py", line 62, in restricted
exec ccode in environment
File "C:\Bin\web2py\applications\sahana/models/db.py", line 107, in
already in use')
File "C:\Bin\web2py\gluon\validators.py", line 763, in __init__
NameError: global name 'tablename' is not defined
I've looked into the code & the only reason that I can think this
would be the case is that request.vars.service is blank.
I've tried to test this by appending a '?service=google' to the end of
the URL but it still fails.
I also tried moving this advanced validation to the controller or even
view without luck...