1
0
Fork 0

admin_service.py: do not need to have seperate lines for a statement.

Bug-561
Lan Hui 2023-07-14 08:30:58 +08:00
parent c284893097
commit cd562a745c
1 changed files with 3 additions and 6 deletions

View File

@ -60,13 +60,10 @@ def article():
return is_admin return is_admin
_article_number = get_number_of_articles() _article_number = get_number_of_articles()
try: try:
_page_size = min( _page_size = min(max(1, int(request.args.get("size", 5))), _article_number) # 最小的size是1
max(1, int(request.args.get("size", 5))), _article_number _cur_page = min(max(1, int(request.args.get("page", 1))), _article_number // _page_size + (_article_number % _page_size > 0)) # 最小的page是1
) # 最小的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: except ValueError:
return "page parameters must be int!" return "page parameters must be int!"