Fixed #13569 -- Fixed createsuperuser management command to work with the new relaxed requirements for usernames.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-05-21 14:08:49 +00:00
parent b057a8b247
commit 286ce85e45
2 changed files with 10 additions and 1 deletions

View File

@ -12,7 +12,8 @@ from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
RE_VALID_USERNAME = re.compile('\w+$') RE_VALID_USERNAME = re.compile('[\w.@+-]+$')
EMAIL_RE = re.compile( EMAIL_RE = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' # quoted-string r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' # quoted-string

View File

@ -66,4 +66,12 @@ Superuser created successfully.
u'joe@somewhere.org' u'joe@somewhere.org'
>>> u.password >>> u.password
u'!' u'!'
>>> call_command("createsuperuser", interactive=False, username="joe+admin@somewhere.org", email="joe@somewhere.org")
Superuser created successfully.
>>> u = User.objects.get(username="joe+admin@somewhere.org")
>>> u.email
u'joe@somewhere.org'
>>> u.password
u'!'
""" """