#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: 0 |
-------------------------------------+-------------------------------------
Changes (by kmtracey):
* stage: Unreviewed => Accepted
Comment:
The arcane error message from sqlilte means a non-utf8 bytestring was
passed as default_username on the call to
`User.objects.get(username=default_username)`. 'J\xfalia' is the latin1
(same as Windows cp1252 for this case) encoding for "Júlia".
If instead you passed in 'J\xc3\xbalia', the utf-8 encoding, the
`User.objects.get` call would work. Due to other code in this area it
would not be accepted as a unsername, but you'd get past that exception.
This error from sqlite is new with 2.6, see #7921 for details and the
explanation of why you can pass utf-8 encoded bytestrings. Django adapted
to the change with 2.6 by installing an adapter to convert all bytestrings
passed down to the database to unicode, assuming they have a utf-8
encoding. If they don't and the attempt to decode from utf-8 fails, you
will see the error message you are seeing.
If there was some way to know the encoding of the bytestring returned by
`getpass.getuser()` then the best thing would be to use that known
encoding to transform the bytestring into a unicode object.
--
Ticket URL: <http://code.djangoproject.com/ticket/15778#comment:3>
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.