#21358: runserver command fails to run with a non-english locale
--------------------------------------------+--------------------
     Reporter:  svartalf                    |      Owner:  nobody
         Type:  Bug                         |     Status:  new
    Component:  Core (Management commands)  |    Version:  master
     Severity:  Normal                      |   Keywords:
 Triage Stage:  Unreviewed                  |  Has patch:  0
Easy pickings:  0                           |      UI/UX:  0
--------------------------------------------+--------------------
 ''runserver'' management command writes current datetime to stdout while
 starting. With a non-english locale it fails for python2.7.3:

 {{{
 svartalf@wonderland:~/projects/irk [django-1.6-upgrade]$ .env/bin/python
 manage.py runserver
 Validating models...

 0 errors found
 Unhandled exception in thread started by <function wrapper at 0x1ec10c8>
 Traceback (most recent call last):
   File "/home/svartalf/projects/irk/.env/lib/python2.7/site-
 packages/django/utils/autoreload.py", line 93, in wrapper
     fn(*args, **kwargs)
   File "/home/svartalf/projects/irk/.env/lib/python2.7/site-
 packages/django/core/management/commands/runserver.py", line 110, in
 inner_run
     "quit_command": quit_command,
   File "/home/svartalf/projects/irk/.env/lib/python2.7/site-
 packages/django/core/management/base.py", line 65, in write
     if ending and not msg.endswith(ending):
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
 ordinal not in range(128)
 }}}

 I've found that ''msg'' variable contains that text with type <type
 'str'>:

 {{{
 Октябрь 31, 2013 - 14:30:02
 Django version 1.6c1, using settings 'settings'
 Starting development server at http://127.0.0.1:8000/
 Quit the server with CONTROL-C
 }}}

 And it comes from that line of code:
 
https://github.com/django/django/blob/2ca00faa913754cd5860f6e1f23c8da2529c691a/django/core/management/commands/runserver.py#L105

 I wrapped it with a ''django.utils.text.smart_text'' and works. Here is a
 link to my fork commit:
 
https://github.com/svartalf/django/commit/76c058de1bab989c296403e8199aa5fe7f0f83f9

 I can pull request it, or maybe, datetime format can be changed to
 something locale-independent.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21358>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.684e4d6902896734cf0d4d1b14c6bca9%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to