mirror of
https://github.com/QingdaoU/Spirit.git
synced 2025-01-07 20:42:08 +00:00
Floor division
This commit is contained in:
parent
2f71faf90a
commit
3d47050118
@ -7,9 +7,10 @@ def get_page_number(obj_number, per_page):
|
||||
if obj_number < per_page:
|
||||
return 1
|
||||
elif obj_number % per_page:
|
||||
return obj_number / per_page + 1
|
||||
# Use floor divison for py23 compatibilty see PEP238
|
||||
return obj_number // per_page + 1
|
||||
else:
|
||||
return obj_number / per_page
|
||||
return obj_number // per_page
|
||||
|
||||
|
||||
def get_url(url, obj_number, per_page, page_var):
|
||||
@ -19,4 +20,4 @@ def get_url(url, obj_number, per_page, page_var):
|
||||
if page == 1:
|
||||
return "".join((url, '#c', str(obj_number)))
|
||||
|
||||
return "".join((url, '?', data, '#c', str(obj_number)))
|
||||
return "".join((url, '?', data, '#c', str(obj_number)))
|
||||
|
Loading…
Reference in New Issue
Block a user