Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit585e3a8

Browse files
Helen KoikeJohnVillalovos
Helen Koike
authored andcommitted
fix(client): regression - do not automatically get_next if page=# and
iterator=True/as_list=False are usedThis fix a regression introduced on commit1339d64If page is used, then get_next should be false.This was found on the mesa ci project, after upgrading the python-gitlabversion, the script that monitors the ci was getting killed by consumingtoo much memory.
1 parent3c7c7fc commit585e3a8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

‎docs/api-usage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ The generator exposes extra listing information as received from the server:
393393
Prior to python-gitlab 3.6.0 the argument ``as_list`` was used instead of
394394
``iterator``. ``as_list=False`` is the equivalent of ``iterator=True``.
395395

396+
..note::
397+
If ``page`` and ``iterator=True`` are used together, the latter is ignored.
398+
396399
Sudo
397400
====
398401

‎gitlab/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ def http_list(
929929

930930
page=kwargs.get("page")
931931

932-
ifiterator:
932+
ifiteratorandpageisNone:
933933
# Generator requested
934934
returnGitlabList(self,url,query_data,**kwargs)
935935

‎tests/unit/test_gitlab_http_methods.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,18 @@ def test_list_request(gl):
542542
assertresponses.assert_call_count(url,3)isTrue
543543

544544

545+
@responses.activate
546+
deftest_list_request_page_and_iterator(gl):
547+
response_dict=copy.deepcopy(large_list_response)
548+
response_dict["match"]= [responses.matchers.query_param_matcher({"page":"1"})]
549+
responses.add(**response_dict)
550+
551+
result=gl.http_list("/projects",iterator=True,page=1)
552+
assertisinstance(result,list)
553+
assertlen(result)==20
554+
assertlen(responses.calls)==1
555+
556+
545557
large_list_response= {
546558
"method":responses.GET,
547559
"url":"http://localhost/api/v4/projects",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp