Ticket #15778: django-createsuperuser-8bit-username-bug.diff

File django-createsuperuser-8bit-username-bug.diff, 707 bytes (added by Hynek Cernoch <hynek@…>, 4 years ago)
  • django/contrib/auth/management/commands/createsuperuser.py

    a b  
    5858
    5959        # Try to determine the current system user's username to use as a default.
    6060        try:
    61             default_username = getpass.getuser().replace(' ', '').lower()
     61            default_username = str(getpass.getuser().decode('ascii', 'ignore')).replace(' ', '').lower()
    6262        except (ImportError, KeyError):
    6363            # KeyError will be raised by os.getpwuid() (called by getuser())
    6464            # if there is no corresponding entry in the /etc/passwd file
Back to Top