Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9859 closed (fixed)

UnicodeDecodeError in admin views for python 2.3.

Reported by: Nils Fredrik Gjerull Owned by: Karen Tracey
Component: contrib.admin Version: dev
Severity: Keywords: unicode unicodedecodeerror
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Because I work in a company that uses python 2.3 on the production server and because I use characters outside the ascii range, I have run onto a number of UnicodeDecodeErrors. Python 2.3 unfortunately has a bug, it calls str methods on objects included in unicode template strings even if the object has a unicode method.

Now I have run onto another one. It was a quick fix to solve this, but it was more difficult to make a regression test for it. This bug is only triggered if a model is registered as a inline, but not registered directly with the admin.

To help fight UnicodeDecodeErrors I have made a new TestCase class in the admin_views regression test with the sole purpose of detecting missing force_unicode calls in the admin views.

Attachments (1)

admin_unicode_fixes.diff (7.2 KB ) - added by Nils Fredrik Gjerull 16 years ago.

Download all attachments as: .zip

Change History (5)

by Nils Fredrik Gjerull, 16 years ago

Attachment: admin_unicode_fixes.diff added

comment:1 by Karen Tracey, 16 years ago

Owner: changed from nobody to Karen Tracey
Status: newassigned
Triage Stage: UnreviewedAccepted

Thanks for the report, fix, and test. Does your company have plans to upgrade to a higher level of Python? Django will be dropping Python 2.3 support at some point, though I'm not sure if it's been finally decided exactly when yet.

comment:2 by Karen Tracey, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [9656]) Fixed #9859 -- Added another missing force_unicode needed in admin when running on Python 2.3. Many thanks for report & patch to nfg.

comment:3 by Karen Tracey, 16 years ago

(In [9657]) Follow-up to r9656 -- beef up the added test to exercise all (one can hope) paths through the troublesome get_deleted_objects function and fix the resulting errors.

Refs #9859.

comment:4 by Karen Tracey, 16 years ago

(In [9658]) [1.0.X] Fixed #9859 -- Added another missing force_unicode needed in admin when running on Python 2.3. Many thanks for report & patch with test to nfg.

Also enhanced the new test to hopefully exercise all paths through the get_deleted_objects function, and fixed the errors pointed out by the beefed-up test.

r9656 and r9657 from trunk.

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