From c3c3a914fa2787ae6a1368fe6550585ee252c901 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 13 Jan 2022 16:05:17 -0800 Subject: [PATCH] chore(objects): use `self.encoded_id` where could be a string Updated a few remaining usages of `self.id` to use `self.encoded_id` where it could be a string value. --- gitlab/v4/objects/groups.py | 2 +- gitlab/v4/objects/projects.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py index 453548b94..662ea5d7b 100644 --- a/gitlab/v4/objects/groups.py +++ b/gitlab/v4/objects/groups.py @@ -92,7 +92,7 @@ def transfer_project(self, project_id: int, **kwargs: Any) -> None: GitlabAuthenticationError: If authentication is not correct GitlabTransferProjectError: If the project could not be transferred """ - path = f"/groups/{self.id}/projects/{project_id}" + path = f"/groups/{self.encoded_id}/projects/{project_id}" self.manager.gitlab.http_post(path, **kwargs) @cli.register_custom_action("Group", ("scope", "search")) diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index 58666ce74..ec0ae391a 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -441,7 +441,7 @@ def upload( with open(filepath, "rb") as f: filedata = f.read() - url = f"/projects/{self.id}/uploads" + url = f"/projects/{self.encoded_id}/uploads" file_info = {"file": (filename, filedata)} data = self.manager.gitlab.http_post(url, files=file_info) @@ -538,7 +538,7 @@ def transfer_project(self, to_namespace: str, **kwargs: Any) -> None: GitlabAuthenticationError: If authentication is not correct GitlabTransferProjectError: If the project could not be transferred """ - path = f"/projects/{self.id}/transfer" + path = f"/projects/{self.encoded_id}/transfer" self.manager.gitlab.http_put( path, post_data={"namespace": to_namespace}, **kwargs )