Ticket #7077: set_default_user_as_admin_if_getpwuid_fails.patch

File set_default_user_as_admin_if_getpwuid_fails.patch, 571 bytes (added by damien_szczyt, 15 years ago)
  • contrib/auth/create_superuser.py

     
    2525        default_username = ''
    2626    else:
    2727        # Determine the current system user's username, to use as a default.
    28         default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
     28   try:
     29       default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
     30   except:
     31       default_username = 'admin'
    2932
    3033    # Determine whether the default username is taken, so we don't display
    3134    # it as an option.
Back to Top