#34758: Paginator.validate_number implementation has undocumented change in 4.2
-------------------------------+--------------------------------------
Reporter: ruidc | Owner: nobody
Type: Uncategorized | Status: closed
Component: Core (Other) | Version: 4.2
Severity: Normal | Resolution: invalid
Keywords: pagination | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:2 ruidc]:
> Replying to [comment:1 Mariusz Felisiak]:
> > In the current implementation `num_pages` cannot be less than 1, so
this branch was unused. This looks like an issue in your custom paginator.
>
> From the code in main, that doesn't seem to be the case:
> {{{
> @cached_property
> def num_pages(self):
> """Return the total number of pages."""
> if self.count == 0 and not self.allow_empty_first_page:
> return 0
> ...
> }}}
It's not possible when `allow_empty_first_page` is `True`.
> Even so, the behavior for this public function changed when a valid
integer of zero is passed.
I don't agree, this branch was unreachable.
--
Ticket URL: <https://code.djangoproject.com/ticket/34758#comment:3>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070189b59af388-42f31e33-2a3d-4fde-b534-39372ed0769e-000000%40eu-central-1.amazonses.com.