From 3d9e6c10da6efb1c7c7e0d4718e8bfa1e886e285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 4 Feb 2023 11:07:04 +0800 Subject: [PATCH] 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. --- src/accounting/utils/pagination.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/accounting/utils/pagination.py b/src/accounting/utils/pagination.py index 3a2eb99..8e3a3ad 100644 --- a/src/accounting/utils/pagination.py +++ b/src/accounting/utils/pagination.py @@ -129,10 +129,6 @@ class Pagination(t.Generic[T]): self.__default_page_no = self.__total_pages if self.__is_reversed \ else 1 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 upper_bound: int = lower_bound + self.page_size if upper_bound > len(self.__items):