Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23723 closed Bug (invalid)

UTF-8 string in AppConfig's verbose_name crashes admin site

Reported by: Igor Koshkarov Owned by: nobody
Component: contrib.admin Version: 1.7
Severity: Normal Keywords: AppConfig verbose_name
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If verbose_name in django.apps.AppConfig has UTF-8 chars, the admin.site application crashes with the following output:
UnicodeDecodeError at /admin/App/

'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Request Method: GET
Request URL: http://localhost:8000/admin/App/
Django Version: 1.7.1
Exception Type: UnicodeDecodeError
Exception Value:

'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Python Version: 2.7.5

The testcase is attached to this ticket.

Attachments (1)

SitesErr.tar (213.5 KB ) - added by Igor Koshkarov 10 years ago.
TestCase

Download all attachments as: .zip

Change History (3)

by Igor Koshkarov, 10 years ago

Attachment: SitesErr.tar added

TestCase

comment:1 by Claude Paroz, 10 years ago

Resolution: invalid
Status: newclosed

You are not supposed to define non-ASCII bytestrings, and that's the case in many other locations in Django.
Either use a the unicode prefix u"..." or add from __future__ import unicode_literals at the top of your file.
Thanks for the example case, that's very useful to quickly find the problem!

comment:2 by Igor Koshkarov, 10 years ago

My fault. Sorry.
The legacy of Java. :-)

Note: See TracTickets for help on using tickets.
Back to Top