Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#4052 closed (duplicate)

implicitly control in paginator causes unexpected return values.

Reported by: meren@… Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: Keywords: paginator
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

Pagiantor doesn't check the 'page_number' value in "has_next_page" and "has_previous_page" functions. It causes this:

>>> from django.core.paginator import ObjectPaginator
>>> from zangetsu.blog.models import Entry
>>> e = Entry.objects.all()
>>> len(e)
262
>>> paginator_result = ObjectPaginator(e, 10)
>>> paginator_result.pages
27
>>> page_number = 0
>>> paginator_result.has_next_page(page)
True
>>> paginator_result.has_previous_page(page)
False
>>> page_number = "0"
>>> paginator_result.has_next_page(page)
False
>>> paginator_result.has_previous_page(page)
True

Please review the patch attached below (I'm sorry if ticket is in the wrong component, I couldn't find any closer).

Thanks,

  1. Murat Eren.

Change History (2)

comment:1 by meren@…, 18 years ago

Has patch: unset
Resolution: duplicate
Status: newclosed

Oh.. This one is a mistake, I tried to stop my browser after I pressed submit button, but it seems I couldn't. Sorry. The real report is here: #4052

comment:2 by meren@…, 18 years ago

Not there, here: #4053 *sigh* (I'm not Peter Sellers and I didn't come here to ruin your ticket system).

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