Opened 11 years ago

Closed 11 years ago

#5932 closed (fixed)

Accessing ObjectPaginator.page_range before pages raises TypeError

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



>>> django.VERSION
(0, 97, 'pre')
>>> paginator = ObjectPaginator(prodcats,3)
>>> paginator.page_range
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home2/username/lib/python2.5/django/core/", line 94, in _get_page_range
    self._page_range = range(1, self._pages + 1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Works if pages is accessed first-

>>> paginator.pages
>>> paginator.page_range
[1, 2]

Change History (1)

comment:1 Changed 11 years ago by Gary Wilson

Resolution: fixed
Status: newclosed

(In [6702]) Fixed #5932 -- Use self.pages and not self._pages in _get_page_range so that an exception is not raised if self.page_range is accessed before self.pages.

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