#29389: Paginator accepts floats as a page number
----------------------------------------+-----------------------------
Reporter: Nicolas Noé | Owner: Nicolas Noé
Type: Bug | Status: assigned
Component: Core (Other) | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+-----------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/29389>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.48a038daa31f1d5b296541d3b9b523a3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.