external_data = gluon.contrib.simplejson.loads(json_data)
db.auth_user.username.requires =
IS_IN_DB(db,'auth_user.username',error_message=T('Username già in uso'))
db.auth_user.username.requires = IS_NOT_EMPTY(error_message=T("Il campo
username non può essere vuoto..."))
.........
ret =
db.auth_user.validate_and_insert(username=external_data['auth_user_username'],
email=external_data['auth_user_email'],
password=external_data['auth_user_password']
)
I'm posting the code which is giving me some problems.
Maybe i didn't catch up how validators work...
Even if external_data['auth_user_username is a empty string the validator
doesn't work and the insert operation goes well.
The validator IS_IN_DB always gives a "error_message" back, this doesn't
happen switching the validators order :
db.auth_user.username.requires = IS_NOT_EMPTY(error_message=T("Il campo
username non può essere vuoto..."))
db.auth_user.username.requires =
IS_IN_DB(db,'auth_user.username',error_message=T('Username già in uso'))
Can anyone help me ?
.........
--
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/groups/opt_out.