Removed the invalid page number handler in the __set_list method of the Pagination utility. The invalid page numbers are handled and redirected in the __get_page_no method now.

This commit is contained in:
依瑪貓 2023-02-04 11:07:04 +08:00
parent 5090e59bb1
commit 3d9e6c10da

View File

@ -129,10 +129,6 @@ class Pagination(t.Generic[T]):
self.__default_page_no = self.__total_pages if self.__is_reversed \ self.__default_page_no = self.__total_pages if self.__is_reversed \
else 1 else 1
self.page_no = self.__get_page_no() self.page_no = self.__get_page_no()
if self.page_no < 1:
self.page_no = 1
if self.page_no > self.__total_pages:
self.page_no = self.__total_pages
lower_bound: int = (self.page_no - 1) * self.page_size lower_bound: int = (self.page_no - 1) * self.page_size
upper_bound: int = lower_bound + self.page_size upper_bound: int = lower_bound + self.page_size
if upper_bound > len(self.__items): if upper_bound > len(self.__items):