File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,11 @@ def set_url(self, url):
190190
191191 def _construct_url (self , id_ , obj , parameters ):
192192 args = _sanitize_dict (parameters )
193- url = obj ._url % args
193+ if id_ is None and obj ._urlPlural is not None :
194+ url = obj ._urlPlural % args
195+ else :
196+ url = obj ._url % args
197+
194198 if id_ is not None :
195199 url = '%s%s/%s' % (self ._url , url , str (id_ ))
196200 else :
@@ -616,6 +620,8 @@ class GitlabObject(object):
616620 """
617621 #: Url to use in GitLab for this object
618622 _url = None
623+ #some objects (e.g. merge requests) have different urls for singular and plural
624+ _urlPlural = None
619625 _returnClass = None
620626 _constructorTypes = None
621627 #: Whether _get_list_or_object should return list or object when id is None
@@ -1063,7 +1069,8 @@ class ProjectMergeRequestNote(GitlabObject):
10631069
10641070
10651071class ProjectMergeRequest (GitlabObject ):
1066- _url = '/projects/%(project_id)s/merge_requests'
1072+ _url = '/projects/%(project_id)s/merge_request'
1073+ _urlPlural = '/projects/%(project_id)s/merge_requests'
10671074 _constructorTypes = {'author' : 'User' , 'assignee' : 'User' }
10681075 canDelete = False
10691076 requiredUrlAttrs = ['project_id' ]
You can’t perform that action at this time.
0 commit comments