Opened 17 years ago
Closed 17 years ago
#5932 closed (fixed)
Accessing ObjectPaginator.page_range before pages raises TypeError
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
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 |
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]
Note:
See TracTickets
for help on using tickets.
(In [6702]) Fixed #5932 -- Use
self.pages
and notself._pages
in_get_page_range
so that an exception is not raised ifself.page_range
is accessed beforeself.pages
.