Today I tried both of variant:
first in default.py
def user():
if request.vars.email:
request.vars.email = request.vars.email.lower().strip()
return dict(form=auth())
don't work - "incorrect email"
second, I don't sure that all right here in db.py
def emailStrip():
form.vars.email = form.vars.email.strip()
return form.vars.email
auth.settings.table_user.email.requires=[emailStrip,IS_LOWER(),IS_EMAIL(),IS_NOT_IN_DB(db,auth.settings.table_user.email)]
I have found custom validators in book also but don't know how to use it.
Where I need to write class?
class sample_validator:
def __init__(self, *a, error_message='error'):
self.a = a
self.e = error_message
def __call__(self, value):
if validate(value):
return (parsed(value), None)
return (value, self.e)
def formatter(self, value):
return format(value)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.