Code

Opened 2 years ago

Closed 2 years ago

#17649 closed Bug (duplicate)

Creating superuser generates exception when system locale is not set

Reported by: chomik Owned by: nobody
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: chomik Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When trying to create superuser with system locale not set (either when syncing db for the first time or invoking manage.py createsuperuser) an exception is rised:

Traceback (most recent call last):
  File "../manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/neaf/sprint/django/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/Users/neaf/sprint/django/django/core/management/__init__.py", line 358, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/neaf/sprint/django/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/neaf/sprint/django/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/neaf/sprint/django/django/contrib/auth/management/commands/createsuperuser.py", line 63, in handle
    default_username = get_default_username()
  File "/Users/neaf/sprint/django/django/contrib/auth/management/__init__.py", line 105, in get_default_username
    default_username = get_system_username()
  File "/Users/neaf/sprint/django/django/contrib/auth/management/__init__.py", line 85, in get_system_username
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None

Attachments (2)

ticket17649.patch (1.5 KB) - added by chomik 2 years ago.
suggested solution
ticket17649_2.patch (1.5 KB) - added by chomik 2 years ago.
test improvement

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by chomik

suggested solution

Changed 2 years ago by chomik

test improvement

comment:1 Changed 2 years ago by chomik

  • Cc chomik added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 2 years ago by neaf

  • Component changed from Uncategorized to contrib.auth
  • Triage Stage changed from Unreviewed to Ready for checkin
  • Type changed from Uncategorized to Bug

comment:3 Changed 2 years ago by lrekucki

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16017, #17185, #17022.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.