Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23140 closed Bug (fixed)

page_range TypeError: sequence index must be integer, not 'slice'

Reported by: Collin Anderson Owned by: nobody
Component: Core (Other) Version: dev
Severity: Release blocker Keywords:
Cc: cmawebsite@… Triage Stage: Accepted
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For years I've running page.paginator.page_range[:] to make a copy of page_range. After #23088, I'm getting the error above. It might just be I'm the only one who's doing this, and should instead just call list(page.paginator.page_range), though it seems to me we list this in backwards incompatibilities and/or defer until 1.8.

Change History (9)

comment:1 by Keryn Knight <django@…>, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

As the instigator of this, given this has technically broken public API by changing the return type in a somewhat incompatible way (who knew that the range/xrange classes don't support slicing!), I'm marking this as accepted and a release blocker, so at least attention is given to it, and a decision may be made before 1.7 final lands.

Should the decision fall on the side of keeping the efficient iterator (at any time, even if postponed), it absolutely ought to end up in the backwards incompatibilities list because it doesn't quack like the same duck as one might be expecting.

comment:2 by Tim Graham <timograham@…>, 10 years ago

In ee0208108bd66cec04b28aca76eb506d9a2e1fd3:

Revert "[1.7.x] Fixed #23088 -- Used six range type in Paginator.page_range."

This reverts commit ce95ab8f025cc9f35990f0c2d9a290eec1ece753.

It caused some backwards compatibility concerns (refs #23140).

comment:3 by Tim Graham, 10 years ago

Component: UncategorizedCore (Other)
Type: UncategorizedBug
Version: 1.7-rc-2master

I've reverted the change on the 1.7 branch for now and changed this to a release blocker for master.

comment:4 by Collin Anderson, 10 years ago

You rock, Timo.

comment:5 by Collin Anderson, 10 years ago

Needs documentation: set

comment:6 by Tim Graham, 10 years ago

If we leave this in, there is also a documentation update needed as noted in #23158.

comment:7 by merb, 10 years ago

btw. https://github.com/django/django/commit/6508db2ff9fc5be95fec903b3fa7ab8204fe316a isn't reverted on the master branch so we should either revert it or update the ticket as closed and merge the documentation change.

Still that would be strange due to the fact that Django 1.7 wouldn't behave as Django 1.8 without any depraction

comment:8 by Florian Apolloner, 10 years ago

Resolution: fixed
Status: newclosed

Consistency is now restored on master and 1.7 with 2d542bf60cc37c59872c5a20d6af3bf826038739 and 1cb919e408d943cf2fadebb2b12517f523feb718 respectively. Closing this for now as the issue should no longer appear.

comment:9 by Collin Anderson, 10 years ago

this ticket is fixed for 1.7, so here's a new ticket for converting to an iterator in 1.8 #23190

Note: See TracTickets for help on using tickets.
Back to Top