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

Commit922041d

Browse files
author
Gauvain Pocentek
committed
Fix the listing of some resources
The parent ID wasn't available in the generated objects, leading toexceptions when trying to use specific methods for these objects.Fixes#132
1 parent92edb99 commit922041d

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

‎gitlab/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ def _raw_get(self, path, content_type=None, streamed=False, **kwargs):
323323
raiseGitlabConnectionError(
324324
"Can't connect to GitLab server (%s)"%e)
325325

326-
def_raw_list(self,path,cls,**kwargs):
326+
def_raw_list(self,path,cls,extra_attrs={},**kwargs):
327327
r=self._raw_get(path,**kwargs)
328328
raise_error_from_response(r,GitlabListError)
329329

330-
cls_kwargs=kwargs.copy()
330+
cls_kwargs=extra_attrs.copy()
331+
cls_kwargs.update(kwargs.copy())
331332

332333
# Add _from_api manually, because we are not creating objects
333334
# through normal path

‎gitlab/objects.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,16 +1059,9 @@ def builds(self, **kwargs):
10591059
"""
10601060
url='/projects/%s/repository/commits/%s/builds'% (self.project_id,
10611061
self.id)
1062-
r=self.gitlab._raw_get(url,**kwargs)
1063-
raise_error_from_response(r,GitlabListError)
1064-
1065-
l= []
1066-
forjinr.json():
1067-
o=ProjectBuild(self,j)
1068-
o._from_api=True
1069-
l.append(o)
1070-
1071-
returnl
1062+
returnself.gitlab._raw_list(url,ProjectBuild,
1063+
{'project_id':self.project_id},
1064+
**kwargs)
10721065

10731066

10741067
classProjectCommitManager(BaseManager):
@@ -1413,7 +1406,9 @@ def closes_issues(self, **kwargs):
14131406
"""
14141407
url= ('/projects/%s/merge_requests/%s/closes_issues'%
14151408
(self.project_id,self.id))
1416-
returnself.gitlab._raw_list(url,ProjectIssue,**kwargs)
1409+
returnself.gitlab._raw_list(url,ProjectIssue,
1410+
{'project_id':self.project_id},
1411+
**kwargs)
14171412

14181413
defcommits(self,**kwargs):
14191414
"""List the merge request commits.
@@ -1427,7 +1422,9 @@ def commits(self, **kwargs):
14271422
"""
14281423
url= ('/projects/%s/merge_requests/%s/commits'%
14291424
(self.project_id,self.id))
1430-
returnself.gitlab._raw_list(url,ProjectCommit,**kwargs)
1425+
returnself.gitlab._raw_list(url,ProjectCommit,
1426+
{'project_id':self.project_id},
1427+
**kwargs)
14311428

14321429
defchanges(self,**kwargs):
14331430
"""List the merge request changes.
@@ -1497,18 +1494,11 @@ class ProjectMilestone(GitlabObject):
14971494
optionalUpdateAttrs=requiredCreateAttrs+optionalCreateAttrs
14981495
shortPrintAttr='title'
14991496

1500-
defissues(self):
1497+
defissues(self,**kwargs):
15011498
url="/projects/%s/milestones/%s/issues"% (self.project_id,self.id)
1502-
r=self.gitlab._raw_get(url)
1503-
raise_error_from_response(r,GitlabDeleteError)
1504-
1505-
l= []
1506-
forjinr.json():
1507-
o=ProjectIssue(self,j)
1508-
o._from_api=True
1509-
l.append(o)
1510-
1511-
returnl
1499+
returnself.gitlab._raw_list(url,ProjectIssue,
1500+
{'project_id':self.project_id},
1501+
**kwargs)
15121502

15131503

15141504
classProjectMilestoneManager(BaseManager):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp