Skip to content

Commit ecad2c8

Browse files
authored
Merge pull request #943 from choyrim/942-project-fork-list-404
#942: fix up path computation for project-fork list
2 parents de98e57 + 516307f commit ecad2c8

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

gitlab/v4/objects.py

+12-15
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,7 @@ class ProjectFork(RESTObject):
20492049

20502050

20512051
class ProjectForkManager(CreateMixin, ListMixin, RESTManager):
2052-
_path = "/projects/%(project_id)s/fork"
2052+
_path = "/projects/%(project_id)s/forks"
20532053
_obj_cls = ProjectFork
20542054
_from_parent_attrs = {"project_id": "id"}
20552055
_list_filters = (
@@ -2069,27 +2069,24 @@ class ProjectForkManager(CreateMixin, ListMixin, RESTManager):
20692069
)
20702070
_create_attrs = (tuple(), ("namespace",))
20712071

2072-
def list(self, **kwargs):
2073-
"""Retrieve a list of objects.
2072+
def create(self, data, **kwargs):
2073+
"""Creates a new object.
20742074
20752075
Args:
2076-
all (bool): If True, return all the items, without pagination
2077-
per_page (int): Number of items to retrieve per request
2078-
page (int): ID of the page to return (starts with page 1)
2079-
as_list (bool): If set to False and no pagination option is
2080-
defined, return a generator instead of a list
2076+
data (dict): Parameters to send to the server to create the
2077+
resource
20812078
**kwargs: Extra options to send to the server (e.g. sudo)
20822079
2083-
Returns:
2084-
list: The list of objects, or a generator if `as_list` is False
2085-
20862080
Raises:
20872081
GitlabAuthenticationError: If authentication is not correct
2088-
GitlabListError: If the server cannot perform the request
2089-
"""
2082+
GitlabCreateError: If the server cannot perform the request
20902083
2091-
path = self._compute_path("/projects/%(project_id)s/forks")
2092-
return ListMixin.list(self, path=path, **kwargs)
2084+
Returns:
2085+
RESTObject: A new instance of the managed object class build with
2086+
the data sent by the server
2087+
"""
2088+
path = self.path[:-1] # drop the 's'
2089+
return CreateMixin.create(self, data, path=path, **kwargs)
20932090

20942091

20952092
class ProjectHook(SaveMixin, ObjectDeleteMixin, RESTObject):

0 commit comments

Comments
 (0)