Opened 7 years ago
Closed 7 years ago
#29389 closed Bug (fixed)
Make Paginator reject non-integer page numbers of type float
Reported by: | Nicolas Noé | Owned by: | Nicolas Noé |
---|---|---|---|
Component: | Core (Other) | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to the docs, the PageNotAnInteger exception is raised when page() is given a value that isn’t an integer.
However, we can see that floats are silently converted to integers:
from django.core.paginator import Paginator objects = ['john', 'paul', 'george', 'ringo'] p = Paginator(objects, 2) p.page(1.2) <Page 1 of 2>
If accepted, I'm willing to provide a patch.
Change History (5)
comment:1 by , 7 years ago
Summary: | Paginator accepts floats as a page number → Make Paginator reject non-integer page numbers of type float |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 7 years ago
comment:3 by , 7 years ago
Has patch: | set |
---|
Note:
See TracTickets
for help on using tickets.
PR