Floor division

This commit is contained in:
Benjamin ABEL 2014-11-03 15:51:51 +01:00
parent 2f71faf90a
commit 3d47050118

View File

@ -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)))