Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7075 closed (fixed)

BUG FIX: Unicode migration breaks django.contrib.admin.views.main.quote

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

Description

This affects django.contrib.admin.views.main.ChangeList.url_for_result:

def url_for_result(self, result):
    return "%s/" % quote(getattr(result, self.pk_attname))

Which no longer works after the Unicode migration, because getattr now returns unicode instead of str.

If someone use a string as a primary key, and the string contains "_[0-9A-Fa-f]{2}", the record will not be editable in admin interface.

Attachments (1)

r7450.diff (511 bytes) - added by Wang Chun <wangchun@…> 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by Wang Chun <wangchun@…>

comment:1 Changed 6 years ago by Wang Chun <wangchun@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by programmerq

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

Would a regression test be appropriate/necessary here?

comment:3 Changed 6 years ago by mir

  • milestone set to 1.0
  • Resolution set to worksforme
  • Status changed from new to closed

comment:4 Changed 6 years ago by mir

  • Resolution worksforme deleted
  • Status changed from closed to reopened

sorry, didn't want to close this ticket. The quoted code line is still there, in spite of newforms admin.

comment:5 Changed 6 years ago by julien

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

I can't find the actual changeset, but this has been fixed anyway. It now sits in django.contrib.admin.util.quote, and all string types -- including unicodes -- should work since it accepts any basestring object.

comment:6 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.