This for me at least was an undesirable behavior change from 4.1
The previous behavior should either be reinstated or the change
documented.
If there is agreement on direction, happy to make the PR either way.
--
Ticket URL: <https://code.djangoproject.com/ticket/34758>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/34758#comment:1>
Comment (by 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
...
```
Even so, the behavior for this public function changed when a valid
integer of zero is passed. Is documentation of this change not in order at
least?
--
Ticket URL: <https://code.djangoproject.com/ticket/34758#comment:2>
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>