Ticket #7431: windows-superuser.diff

File windows-superuser.diff, 1.0 KB (added by Eric Holscher, 16 years ago)
  • contrib/auth/management/commands/createsuperuser.py

     
    4646        password = ''
    4747
    4848        # Try to determine the current system user's username to use as a default.
    49         try:
    50             import pwd
    51         except ImportError:
    52             default_username = ''
    53         else:
    54             default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
     49        default_username = os.path.expanduser("~").replace(' ', '').lower().split(os.sep)[-1]
    5550
    5651        # Determine whether the default username is taken, so we don't display
    5752        # it as an option.
     
    6762        # try/except to trap for a keyboard interrupt and exit gracefully.
    6863        if interactive:
    6964            try:
    70            
     65
    7166                # Get a username
    7267                while 1:
    7368                    if not username:
Back to Top