Skip to content

#942: fix up path computation for project-fork list #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions gitlab/v4/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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):
Expand Down