#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):
#15162 has similar guess of the encoding: {{{ locale.getdefaultlocale()[1]
}}}
- It returns more explicit names e.g 'cp1250', 'cp1252' than
sys.getfilesystemencoding() which returns 'mbcs'.
- Decoded characters are the same for both methods. Encoding 'cp1250' is a
subset defined for 251 characters, 'mbcs' is defined for all 256
characters.
Conclusion: I think that better is:
{{{
locale.getdefaultlocale()[1]
}}}
Characters from non-default encoding are replaced by question marks before
any conversion by 'getpass.getuser()'. E. g. 'ů' on West Europe Windows or
vice-versa 'ù' on East Europe Windows. Better is no suggestion than a bad
one. Therefore I add:
{{{
+ if not RE_VALID_USERNAME.match(default_username):
+ default_username = ''
}}}
My final patch
[[http://code.djangoproject.com/attachment/ticket/15778/createsuperuser.diff|createsuperuser.diff]]
is ready.
--
Ticket URL: <http://code.djangoproject.com/ticket/15778#comment:9>
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.