#15778: Command createsuperuser fails under some system user names
-------------------------------------+-----------------------------
 Reporter:  Hynek Cernoch <hynek@…>  |         Owner:  nobody
     Type:  Bug                      |        Status:  new
Milestone:  1.3                      |     Component:  contrib.auth
  Version:  1.3                      |      Severity:  Normal
 Keywords:                           |  Triage Stage:  Unreviewed
Has patch:  1                        |
-------------------------------------+-----------------------------
 Commands 'createsuperuser' and 'syncdb' can not create a superuser account
 no way because of database error,
 if a system account username contains an 8-bit character.
 It fails when the name is automatically searched in the database, even if
 the user wants to write an ascii username manually.
 This is typical for usernames created by Microsoft Windows.

 {{{
 File "C:\Python26\lib\site-
 packages\django\contrib\auth\management\commands\createsuperuser.py", line
 72, in handle
   User.objects.get(username=default_username)
 ...
 File "C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py",
 line 234, in execute
   return Database.Cursor.execute(self, query, params)
 DatabaseError : You must not use 8-bit bytestrings unless you use a
 text_factory that can interpret
 8-bit bytestrings (like text_factory = str). It is highly recommended that
 you instead just switch
 your application to Unicode strings.
 }}}


 Versions: Django 1.3, Python 2.6.4 windows, Sqlite3 3.5.9, dbapi 2.4.1

 It is easier to fix it once then to circumvent it twice.

 The middle part of the patch:
 {{{
 -            default_username = getpass.getuser().replace(' ', '').lower()
 +            default_username = str(getpass.getuser().decode('ascii',
 'ignore')).replace(' ', '').lower()
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15778>
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.

Reply via email to