X Tutup
Skip to content

2.1.0 regression when using all=True on project.mergerequests.list() #1044

@dmerejkowsky

Description

@dmerejkowsky

Description of the problem, including code/CLI snippet

import os
import dotenv
from gitlab import Gitlab


dotenv.load_dotenv()
gitlab_url = os.environ["GITLAB_URL"]
gitlab_token = os.environ["GITLAB_TOKEN"]
project_name = os.environ["PROJECT_NAME"]

gitlab = Gitlab(gitlab_url, private_token=gitlab_token)
project = gitlab.projects.get(project_name)
all_mrs = project.mergerequests.list(state="opened", all=True")
print(all_mrs)

Expected Behavior

The list of all opened merge requests is returned

Actual Behavior

Code crashes with:

Traceback (most recent call last):
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/exceptions.py", line 271, in wrapped_f
    return f(*args, **kwargs)
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/mixins.py", line 141, in list
    obj = self.gitlab.http_list(path, **data)
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/__init__.py", line 651, in http_list
    return list(GitlabList(self, url, query_data, **kwargs))
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/__init__.py", line 778, in __init__
    self._query(url, query_data, **kwargs)
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/__init__.py", line 783, in _query
    result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/__init__.py", line 573, in http_request
    response_body=result.content,
gitlab.exceptions.GitlabHttpError: 400: order_by does not have a valid value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bug.py", line 13, in <module>
    all_mrs = project.mergerequests.list(state="opened", all=True)
  File "/home/dmerej/3rdpart/python-gitlab/gitlab/exceptions.py", line 273, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body)
gitlab.exceptions.GitlabListError: 400: order_by does not have a valid value

Specifications

  • python-gitlab version: 6c5458a
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 12.8.2-ee

Notes:

  • The code used to work with 2.0.0 release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup