diff options
author | John L. Villalovos <john@sodarock.com> | 2021-03-14 16:21:45 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-03-15 08:34:43 -0700 |
commit | 2afd18aa28742a3267742859a88be6912a803874 (patch) | |
tree | f533941c0a3aeef6346a5345a8e624716f196e1d /gitlab/mixins.py | |
parent | 8ace76a8a5596171c782570fdde7a82119aeb9ff (diff) | |
download | gitlab-2afd18aa28742a3267742859a88be6912a803874.tar.gz |
chore: remove usage of getattr()
Remove usage of getattr(self, "_update_uses_post", False)
Instead add it to class and set default value to False.
Add a tests that shows it is set to True for the
ProjectMergeRequestApprovalManager and ProjectApprovalManager classes.
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index fd77904..2918007 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -331,6 +331,7 @@ class UpdateMixin(_RestManagerBase): _parent = Optional[base.RESTObject] _parent_attrs = Dict[str, Any] _path: Optional[str] + _update_uses_post: bool = False gitlab: gitlab.Gitlab def _check_missing_update_attrs(self, data: Dict[str, Any]) -> None: @@ -357,7 +358,7 @@ class UpdateMixin(_RestManagerBase): Returns: object: http_put (default) or http_post """ - if getattr(self, "_update_uses_post", False): + if self._update_uses_post: http_method = self.gitlab.http_post else: http_method = self.gitlab.http_put |