Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4052 closed (duplicate)

implicitly control in paginator causes unexpected return values.

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

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.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by meren@…

  • Has patch unset
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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 Changed 7 years ago by meren@…

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.