Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Fixed #1405 -- 'createsuperuser' no longer assumes 'im…

…port pwd' will work. Thanks, anonymous

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b2dd439085fb300a4ce0d921a268d22f5b696486 1 parent e8cfcf2
Adrian Holovaty authored March 01, 2006

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  django/core/management.py
11  django/core/management.py
@@ -660,10 +660,15 @@ def createsuperuser(username=None, email=None, password=None):
660 660
     "Creates a superuser account."
661 661
     from django.core import validators
662 662
     from django.contrib.auth.models import User
663  
-    import getpass, pwd
  663
+    import getpass
664 664
 
665  
-    # Determine the current system user's username, to use as a default.
666  
-    default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
  665
+    try:
  666
+        import pwd
  667
+    except ImportError:
  668
+        default_username = ''
  669
+    else:
  670
+        # Determine the current system user's username, to use as a default.
  671
+        default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
667 672
 
668 673
     # Determine whether the default username is taken, so we don't display
669 674
     # it as an option.

0 notes on commit b2dd439

Please sign in to comment.
Something went wrong with that request. Please try again.