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/mixins.py | |
parent | a2e7c383e10509b6eb0fa8760727036feb0807c8 (diff) | |
download | gitlab-jlvillal/encoded_id.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/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index a6794d0..b79c29e 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -99,7 +99,8 @@ class GetMixin(_RestManagerBase): GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server cannot perform the request """ - id = utils._url_encode(id) + if isinstance(id, str): + id = utils.EncodedId(id) path = f"{self.path}/{id}" if TYPE_CHECKING: assert self._obj_cls is not None @@ -390,7 +391,7 @@ class UpdateMixin(_RestManagerBase): if id is None: path = self.path else: - path = f"{self.path}/{utils._url_encode(id)}" + path = f"{self.path}/{utils.EncodedId(id)}" self._check_missing_update_attrs(new_data) files = {} @@ -443,7 +444,7 @@ class SetMixin(_RestManagerBase): Returns: The created/updated attribute """ - path = f"{self.path}/{utils._url_encode(key)}" + path = f"{self.path}/{utils.EncodedId(key)}" data = {"value": value} server_data = self.gitlab.http_put(path, post_data=data, **kwargs) if TYPE_CHECKING: @@ -476,7 +477,7 @@ class DeleteMixin(_RestManagerBase): if id is None: path = self.path else: - path = f"{self.path}/{utils._url_encode(id)}" + path = f"{self.path}/{utils.EncodedId(id)}" self.gitlab.http_delete(path, **kwargs) |