Commit c7133b75 authored by Florian Fuchs's avatar Florian Fuchs

REST API collection pagination: slice result only if pagination params are present in GET request

parent e0b49799
......@@ -137,10 +137,14 @@ def paginate(default_count=None):
# Set indices
list_start = 0
list_end = None
# get the result
result = function(*args, **kwargs)
# slice list only if count is not None
if count is not None:
list_start = int((page - 1) * count)
list_end = int(page * count)
return function(*args, **kwargs)[list_start:list_end]
return result[list_start:list_end]
return result
return wrapper
return dec
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment