Revised to redirect on invalid page size and page number on pagination.

This commit is contained in:
2020-07-01 23:39:32 +08:00
parent 8cab91dcd2
commit 1ddfc96621
2 changed files with 69 additions and 29 deletions

View File

@ -70,4 +70,8 @@ class Pagination:
if page_no is not None \
else 1 if not is_reverse else total_pages
if self.page_no > total_pages:
self.page_no = total_pages
raise PageNoOutOfRangeError()
class PageNoOutOfRangeError(Exception):
pass