diff options
| author | John L. Villalovos <john@sodarock.com> | 2022-01-13 11:17:40 -0800 |
|---|---|---|
| committer | John L. Villalovos <john@sodarock.com> | 2022-01-13 11:17:40 -0800 |
| commit | b07eece0a35dbc48076c9ec79f65f1e3fa17a872 (patch) | |
| tree | 7a3109087cee26308c4359d4cdcdada8999d5b22 /gitlab/v4/objects | |
| parent | a2e7c383e10509b6eb0fa8760727036feb0807c8 (diff) | |
| download | gitlab-b07eece0a35dbc48076c9ec79f65f1e3fa17a872.tar.gz | |
chore: replace usage of utils._url_encode() with utils.EncodedId()jlvillal/encoded_id
utils.EncodedId() has basically the same functionalityy of using
utils._url_encode(). So remove utils._url_encode() as we don't need
it.
Diffstat (limited to 'gitlab/v4/objects')
| -rw-r--r-- | gitlab/v4/objects/features.py | 2 | ||||
| -rw-r--r-- | gitlab/v4/objects/files.py | 12 | ||||
| -rw-r--r-- | gitlab/v4/objects/repositories.py | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/gitlab/v4/objects/features.py b/gitlab/v4/objects/features.py index 69689fa..1631a26 100644 --- a/gitlab/v4/objects/features.py +++ b/gitlab/v4/objects/features.py @@ -52,7 +52,7 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager): Returns: The created/updated attribute """ - name = utils._url_encode(name) + name = utils.EncodedId(name) path = f"{self.path}/{name}" data = { "value": value, diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py index 644c017..0a56fef 100644 --- a/gitlab/v4/objects/files.py +++ b/gitlab/v4/objects/files.py @@ -56,7 +56,7 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject): """ self.branch = branch self.commit_message = commit_message - self.file_path = utils._url_encode(self.file_path) + self.file_path = utils.EncodedId(self.file_path) super(ProjectFile, self).save(**kwargs) @exc.on_http_error(exc.GitlabDeleteError) @@ -144,7 +144,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa assert data is not None self._check_missing_create_attrs(data) new_data = data.copy() - file_path = utils._url_encode(new_data.pop("file_path")) + file_path = utils.EncodedId(new_data.pop("file_path")) path = f"{self.path}/{file_path}" server_data = self.gitlab.http_post(path, post_data=new_data, **kwargs) if TYPE_CHECKING: @@ -173,7 +173,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa """ new_data = new_data or {} data = new_data.copy() - file_path = utils._url_encode(file_path) + file_path = utils.EncodedId(file_path) data["file_path"] = file_path path = f"{self.path}/{file_path}" self._check_missing_update_attrs(data) @@ -203,7 +203,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa GitlabAuthenticationError: If authentication is not correct GitlabDeleteError: If the server cannot perform the request """ - file_path = utils._url_encode(file_path) + file_path = utils.EncodedId(file_path) path = f"{self.path}/{file_path}" data = {"branch": branch, "commit_message": commit_message} self.gitlab.http_delete(path, query_data=data, **kwargs) @@ -239,7 +239,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa Returns: The file content """ - file_path = utils._url_encode(file_path) + file_path = utils.EncodedId(file_path) path = f"{self.path}/{file_path}/raw" query_data = {"ref": ref} result = self.gitlab.http_get( @@ -266,7 +266,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa Returns: A list of commits/lines matching the file """ - file_path = utils._url_encode(file_path) + file_path = utils.EncodedId(file_path) path = f"{self.path}/{file_path}/blame" query_data = {"ref": ref} result = self.gitlab.http_list(path, query_data, **kwargs) diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py index ca70b5b..4e8169f 100644 --- a/gitlab/v4/objects/repositories.py +++ b/gitlab/v4/objects/repositories.py @@ -39,7 +39,7 @@ class RepositoryMixin(_RestObjectBase): GitlabPutError: If the submodule could not be updated """ - submodule = utils._url_encode(submodule) + submodule = utils.EncodedId(submodule) path = f"/projects/{self.encoded_id}/repository/submodules/{submodule}" data = {"branch": branch, "commit_sha": commit_sha} if "commit_message" in kwargs: |
