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

Convert response list to single data source for iid requests#169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletionsgitlab/objects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -378,6 +378,22 @@ def __init__(self, gl, data=None, **kwargs):
data = self.gitlab.get(self.__class__, data, **kwargs)
self._from_api = True

# the API returned a list because custom kwargs where used
# instead of the id to request an object. Usually parameters
# other than an id return ambiguous results. However in the
# gitlab universe iids together with a project_id are
# unambiguous for merge requests and issues, too.
# So if there is only one element we can use it as our data
# source.
if 'iid' in kwargs and isinstance(data, list):
if len(data) < 1:
raise GitlabGetError('Not found')
elif len(data) == 1:
data = data[0]
else:
raise GitlabGetError('Impossible! You found multiple'
' elements with the same iid.')

self._set_from_dict(data, **kwargs)

if kwargs:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp