Code

Opened 2 years ago

Closed 2 years ago

#17128 closed Bug (fixed)

Python 2.5-incompatible change in r16319 -- ModelAdmin.list_display.index method called

Reported by: DrMeers Owned by: DrMeers
Component: contrib.admin Version: master
Severity: Normal Keywords: python 2.5, tuple, index, list_display
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

r16319 introduced a python 2.5-incompatible change in which ModelAdmin.list_display's index method is called despite the fact that it is likely a tuple (which only has an index method in 2.6+).

I imagine this managed to hide for so long because:

  • No tests failed -- some use lists for list_display, and most don't have ordering set on the ModelAdmin or Model.Meta
  • ChangeLists for which actions were present (which they are by default) have their list_display listified when action_checkbox is prepended (bypassed if rendering the result_list without using changelist_view)
  • The number of people using Django trunk with Python 2.5 are no doubt a minority

I've attached a patch which addresses the issue and includes regression tests, which I'll commit unless someone thinks it could be done better.

Attachments (1)

17128.diff (8.7 KB) - added by DrMeers 2 years ago.

Download all attachments as: .zip

Change History (3)

Changed 2 years ago by DrMeers

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

This looks good to me.

comment:2 Changed 2 years ago by jezdez

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

In [17102]:

Fixed #17128 -- Fixed a Python 2.5 incompatibility. Thanks, Simon Meers.

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.