diff options
author | Max Wittig <max.wittig@siemens.com> | 2019-11-20 10:43:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 10:43:25 +0100 |
commit | ecad2c83635c5e5f7003f61502391446ebc631c9 (patch) | |
tree | e6305bb483a39501c59acfc5f16eff3887d7631b | |
parent | de98e572b003ee4cf2c1ef770a692f442c216247 (diff) | |
parent | 516307f1cc9e140c7d85d0ed0c419679b314f80b (diff) | |
download | gitlab-ecad2c83635c5e5f7003f61502391446ebc631c9.tar.gz |
Merge pull request #943 from choyrim/942-project-fork-list-404
#942: fix up path computation for project-fork list
-rw-r--r-- | gitlab/v4/objects.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 3ac7a4a..2b1f955 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2049,7 +2049,7 @@ class ProjectFork(RESTObject): class ProjectForkManager(CreateMixin, ListMixin, RESTManager): - _path = "/projects/%(project_id)s/fork" + _path = "/projects/%(project_id)s/forks" _obj_cls = ProjectFork _from_parent_attrs = {"project_id": "id"} _list_filters = ( @@ -2069,27 +2069,24 @@ class ProjectForkManager(CreateMixin, ListMixin, RESTManager): ) _create_attrs = (tuple(), ("namespace",)) - def list(self, **kwargs): - """Retrieve a list of objects. + def create(self, data, **kwargs): + """Creates a new object. Args: - all (bool): If True, return all the items, without pagination - per_page (int): Number of items to retrieve per request - page (int): ID of the page to return (starts with page 1) - as_list (bool): If set to False and no pagination option is - defined, return a generator instead of a list + data (dict): Parameters to send to the server to create the + resource **kwargs: Extra options to send to the server (e.g. sudo) - Returns: - list: The list of objects, or a generator if `as_list` is False - Raises: GitlabAuthenticationError: If authentication is not correct - GitlabListError: If the server cannot perform the request - """ + GitlabCreateError: If the server cannot perform the request - path = self._compute_path("/projects/%(project_id)s/forks") - return ListMixin.list(self, path=path, **kwargs) + Returns: + RESTObject: A new instance of the managed object class build with + the data sent by the server + """ + path = self.path[:-1] # drop the 's' + return CreateMixin.create(self, data, path=path, **kwargs) class ProjectHook(SaveMixin, ObjectDeleteMixin, RESTObject): |