From cd562a745c23088bfdb8afda537f913a1386ebe2 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Fri, 14 Jul 2023 08:30:58 +0800 Subject: [PATCH] admin_service.py: do not need to have seperate lines for a statement. --- app/admin_service.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/admin_service.py b/app/admin_service.py index 8d71f20..bd529a9 100644 --- a/app/admin_service.py +++ b/app/admin_service.py @@ -60,13 +60,10 @@ def article(): return is_admin _article_number = get_number_of_articles() + try: - _page_size = min( - max(1, int(request.args.get("size", 5))), _article_number - ) # 最小的size是1 - _cur_page = min( - max(1, int(request.args.get("page", 1))), _article_number // _page_size + (_article_number % _page_size > 0) - ) # 最小的page是1 + _page_size = min(max(1, int(request.args.get("size", 5))), _article_number) # 最小的size是1 + _cur_page = min(max(1, int(request.args.get("page", 1))), _article_number // _page_size + (_article_number % _page_size > 0)) # 最小的page是1 except ValueError: return "page parameters must be int!"