FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Pagination broken on ProjectIssues · Issue #140 · python-gitlab/python-gitlab · GitHub

Repository navigation

Pagination broken on ProjectIssues #140

Description

Only the first page is returned regardless of the value of page parameter. The per_page param also is ignored.

>>> gl = gitlab.Gitlab(gitlab_url, gitlab_secret)
>>> proj = gl.projects.get(project)
>>> [x.iid for x in proj.issues.list(page=1)]
[237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218]
>>> [x.iid for x in proj.issues.list(page=2)]
[237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218]
>>> [x.iid for x in proj.issues.list(page=1, per_page=5)]
[237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218]

It appears that Gitlab.list() boils down to the following:

url = self._construct_url(id_=None, obj=obj_class, parameters=kwargs)
return self._raw_list(url, obj_class, **kwargs)

In _raw_list, pagination params are stripped from the query:

for key in ['all', 'page', 'per_page', 'sudo', 'next_url']:
    if key in params:
        del params[key]

Activity

  1. self-assigned this
    on Sep 3, 2016
  2. gpocentek commented on Sep 3, 2016

    Contributor

    _raw_list() is indeed broken, thanks for the report.

  3. gpocentek commented on Sep 3, 2016

    Contributor

    Could you test the master branch and tell me if it works fine for you now? I'll prepare a new release if it's OK. Thanks.

  4. tmick0 commented on Sep 3, 2016

    Author

    Looks like it works

    >>> [x.iid for x in proj.issues.list(page=1)]
    [237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218]
    >>> [x.iid for x in proj.issues.list(page=2)]
    [217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198]
    

    Thanks for the fix

  5. gpocentek commented on Sep 3, 2016

    Contributor

    Thanks for your feedback. I'll push a 0.15.1 soon.

  6. locked as resolved and limited conversation to collaborators on Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL