Skip to content

Commit

Permalink
fix url when fetching a single MergeRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanklug committed Aug 12, 2015
1 parent 802c144 commit 227f71c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gitlab/__init__.py
Expand Up @@ -190,7 +190,11 @@ def set_url(self, url):

def _construct_url(self, id_, obj, parameters):
args = _sanitize_dict(parameters)
url = obj._url % args
if id_ is None and obj._urlPlural is not None:
url = obj._urlPlural % args
else:
url = obj._url % args

if id_ is not None:
url = '%s%s/%s' % (self._url, url, str(id_))
else:
Expand Down Expand Up @@ -616,6 +620,8 @@ class GitlabObject(object):
"""
#: Url to use in GitLab for this object
_url = None
#some objects (e.g. merge requests) have different urls for singular and plural
_urlPlural = None
_returnClass = None
_constructorTypes = None
#: Whether _get_list_or_object should return list or object when id is None
Expand Down Expand Up @@ -1063,7 +1069,8 @@ class ProjectMergeRequestNote(GitlabObject):


class ProjectMergeRequest(GitlabObject):
_url = '/projects/%(project_id)s/merge_requests'
_url = '/projects/%(project_id)s/merge_request'
_urlPlural = '/projects/%(project_id)s/merge_requests'
_constructorTypes = {'author': 'User', 'assignee': 'User'}
canDelete = False
requiredUrlAttrs = ['project_id']
Expand Down

0 comments on commit 227f71c

Please sign in to comment.