#15778: Command createsuperuser fails under some system user names
-------------------------------------+-------------------------------------
Reporter: Hynek | Owner: nobody
Cernoch <hynek@…> | Status: new
Type: Bug | Component: contrib.auth
Milestone: 1.3 | Severity: Normal
Version: 1.3 | Keywords:
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 |
Patch needs improvement: 1 |
-------------------------------------+-------------------------------------
Comment (by hynekcer):
This is much better. :-) I preferred a simple solution and strong
arguments such as example names similar to a member of the community and
the person who requested a test :-)
I thought so: Without a patch or with any failing patch the person
probably lost several hours, because the simple bypass "./manage.py syncdb
--noinput; ./manage.py createsuperuser --username=USERNAME" can be easily
missed. With a simple patch he lost only several minutes, because
unfortunately only a journalist is able to notice every missing letter.
(Maybe a user can not login first.)
I am not sure enough that "getpass.getuser()" returns results in the
encoding "sys.getfilesystemencoding()" for every language and version of
Windows and Python. Otherwise the conversion fails. I only hope that
Microsoft was never so proud to implement the right to left picture
alphabets to the home directory paths. We should use some "decode(...,
'ignore')".
I suggest:
{{{
default_username = getpass.getuser().decode(sys.getfilesystemencoding(),
'ignore')
default_username = unicodedata.normalize('NFKD', default_username) \
.encode('ascii', 'ignore').replace(' ', '').lower()
}}}
Hopefully the "unicodedata.normalize('NFKD'...)" does not raise an
exception, otherwise it should be added to captured exceptions, not only
(!ImportError, !KeyError).
--
Ticket URL: <http://code.djangoproject.com/ticket/15778#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.