# HG changeset patch # User Daniele Nicolodi # Date 1313935823 -7200 # Node ID da7cab4398c3e592eee59b9329dc3b1d4ae7d8e3 # Parent 8dfcaabaee15c57aeff4ee280017b7c800579102 MySQL limits usernames to 16 characters. Reflect this limitation in the form validation code. diff -r 8dfcaabaee15 -r da7cab4398c3 src/ltpdarepo/user.py --- 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")