Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9859 closed (fixed)

UnicodeDecodeError in admin views for python 2.3.

Reported by: nfg Owned by: kmtracey
Component: contrib.admin Version: master
Severity: Keywords: unicode unicodedecodeerror
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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 nfg 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by nfg

comment:1 Changed 8 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to kmtracey
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 8 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

(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 Changed 8 years ago by kmtracey

(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 Changed 8 years ago by kmtracey

(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