Django

Code

Ticket #5932 (closed: fixed)

Opened 8 months ago

Last modified 8 months ago

Accessing ObjectPaginator.page_range before pages raises TypeError

Reported by: anonymous Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation:
Needs tests: Patch needs improvement:

Description

Example

>>> 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/paginator.py", 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
2
>>> paginator.page_range
[1, 2]

Attachments

Change History

11/19/07 00:10:23 changed by gwilson

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

(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.


Add/Change #5932 (Accessing ObjectPaginator.page_range before pages raises TypeError)




Change Properties
Action