#34758 closed Uncategorized (invalid)
Paginator.validate_number implementation has undocumented change in 4.2
Reported by: | ruidc | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 4.2 |
Severity: | Normal | Keywords: | pagination |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (3)
follow-up: 2 comment:1 by , 15 months ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 15 months ago
Replying to 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?
comment:3 by , 15 months ago
Replying to ruidc:
Replying to 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.
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.