Django

Code

Ticket #8151 (closed: fixed)

Opened 4 months ago

Last modified 3 months ago

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

Reported by: kmtracey Assigned to: nobody
Milestone: 1.0 Component: django.contrib.admin
Version: SVN Keywords:
Cc: eallik@gmail.com Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

08/07/08 10:48:58 changed by Karen Tracey <kmtracey@gmail.com>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

08/07/08 11:57:08 changed by Erik Allik <eallik@gmail.com>

  • cc set to eallik@gmail.com.

08/08/08 13:07:33 changed 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.

08/12/08 12:06:15 changed by jacob

  • stage changed from Unreviewed to Accepted.

08/24/08 20:19:00 changed by julien

  • status changed from new to closed.
  • resolution set to fixed.

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

08/24/08 20:20:21 changed by julien

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


Add/Change #8151 (UnicodeDecodeError from /django/contrib/admin/options.py in save_change)




Change Properties
Action