Mercurial > hg > ltpdarepo
changeset 83:da7cab4398c3
MySQL limits usernames to 16 characters.
Reflect this limitation in the form validation code.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Sun, 21 Aug 2011 16:10:23 +0200 |
parents | 8dfcaabaee15 |
children | 5a3c91771914 |
files | src/ltpdarepo/user.py |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/user.py Sun Aug 21 16:08:21 2011 +0200 +++ b/src/ltpdarepo/user.py Sun Aug 21 16:10:23 2011 +0200 @@ -16,13 +16,18 @@ class IUser(Form): - username = TextField("Username", validators=[validators.Required(), - validators.Regexp(r'^[a-zA-Z][0-9a-zA-Z\-\._]+$', - message=u'Invalid identifier.')]) + username = TextField("Username", + validators=[validators.Required(), + validators.Length(max=16, + message=u'Usernames cannot be ' + 'longer than 16 characters'), + validators.Regexp(r'^[a-zA-Z][0-9a-zA-Z\-\._]+$', + message=u'Invalid identifier.')]) name = TextField("Given name") surname = TextField("Family name") - email = TextField("Email", validators=[validators.Required(), - validators.Email()]) + email = TextField("Email", + validators=[validators.Required(), + validators.Email()]) telephone = TextField("Telephone") institution = TextField("Institution") admin = BooleanField("Admin")