1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

Fixed #5753 -- Allow createsuperuser to work in situations where there

might be a valid password database entry for the current user id.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9158 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-10-06 04:54:14 +00:00
parent e2b02eae10
commit c58c1f43cf

View File

@ -57,10 +57,12 @@ class Command(BaseCommand):
# Try to determine the current system user's username to use as a default.
try:
import pwd
except ImportError:
default_username = ''
else:
default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
except (ImportError, KeyError):
# KeyError will be raised by getpwuid() if there is no
# corresponding entry in the /etc/passwd file (a very restricted
# chroot environment, for example).
default_username = ''
# Determine whether the default username is taken, so we don't display
# it as an option.