Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8151 closed (fixed)

UnicodeDecodeError from /django/contrib/admin/options.py in save_change

Reported by: kmtracey Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: eallik@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

As reported here: http://groups.google.com/group/django-users/msg/845d2a8899bbb57c

The failing line of code in the dpaste traceback is:

File "/home/rime/www/tammeoue/packages/django/contrib/admin/options.py" in save_change
  431.         msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': new_object}

This is similar to #7992/#8016 -- some code that moved from django/contrib/admin/views/main.py in old admin to django/contrib/admin/options.py in newforms-admin was missed when the Unicode changes were merged from trunk to newforms-admin. The corresponding line of code in pre-NFA (http://code.djangoproject.com/browser/django/tags/notable_moments/pre-newforms-admin/django/contrib/admin/views/main.py#L354) is:

            msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(new_object)}

That is, there is a force_unicode around the new_object as well as opts.verbose_name. It's probably worth a closer look to see if any other places have been missed; I'll do this when I get a chance but don't wait on me to fix it if someone else gets to it first.

Attachments (0)

Change History (7)

comment:1 Changed 6 years ago by Karen Tracey <kmtracey@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

#8153 reports the same problem and includes a patch that catches one more instance of missing force_unicode wrapper.

comment:2 Changed 6 years ago by RaceCondition

  • Cc eallik@… added

comment:3 Changed 6 years ago by mtredinnick

(In [8236]) Added a few force_unicode() calls around objects in the admin. Required for
Python 2.3 compatibility. Patch from nfg.

Refs #8151, #8153.

comment:4 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 6 years ago by julien

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

I'm not sure why this ticket was reopened. Probably a mistake. It seems that the reported issue has been fixed in [8236].

comment:6 Changed 6 years ago by julien

Correction: it was not reopened, but it hadn't been closed (as I guessed it should have been).

comment:7 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.