Skip to content

Commit

Permalink
fix: disable default keyset pagination
Browse files Browse the repository at this point in the history
Instead we set pagination to offset on the other paths
  • Loading branch information
max-wittig committed Jun 9, 2020
1 parent 1f7dbc8 commit e71fe16
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
10 changes: 0 additions & 10 deletions gitlab/__init__.py
Expand Up @@ -643,17 +643,7 @@ def http_list(self, path, query_data=None, as_list=None, **kwargs):
get_all = kwargs.pop("all", False)
url = self._build_url(path)

order_by = kwargs.get("order_by")
pagination = kwargs.get("pagination")
page = kwargs.get("page")
if (
path in ALLOWED_KEYSET_ENDPOINTS
and (not order_by or order_by == "id")
and (not pagination or pagination == "keyset")
and not page
):
kwargs["pagination"] = "keyset"
kwargs["order_by"] = "id"

if get_all is True and as_list is True:
return list(GitlabList(self, url, query_data, **kwargs))
Expand Down
1 change: 1 addition & 0 deletions tools/python_test_v4.py
Expand Up @@ -421,6 +421,7 @@

assert len(gl.projects.list(owned=True)) == 2
assert len(gl.projects.list(search="admin")) == 1
assert len(gl.projects.list(as_list=False)) == 4

# test pagination
l1 = gl.projects.list(per_page=1, page=1)
Expand Down

0 comments on commit e71fe16

Please sign in to comment.