diff options
author | Eric Sabouraud <esabouraud@users.noreply.github.com> | 2018-06-08 19:11:11 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-08 19:11:11 +0200 |
commit | 473dc6f50d27b2e5349bb2e7c8bc07b48e9834d1 (patch) | |
tree | a7dc99880bf03fd036a548e133d0992c8f57aa2f /gitlab/mixins.py | |
parent | bbefb9936a18909d28d0f81b6ce99d4981ab8148 (diff) | |
download | gitlab-473dc6f50d27b2e5349bb2e7c8bc07b48e9834d1.tar.gz |
Add support for project-level MR approval configuration
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 966a647..59fcf1b 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -223,6 +223,18 @@ class UpdateMixin(object): """ return getattr(self, '_update_attrs', (tuple(), tuple())) + def _get_update_method(self): + """Return the HTTP method to use. + + Returns: + object: http_put (default) or http_post + """ + if getattr(self, '_update_uses_post', False): + http_method = self.gitlab.http_post + else: + http_method = self.gitlab.http_put + return http_method + @exc.on_http_error(exc.GitlabUpdateError) def update(self, id=None, new_data={}, **kwargs): """Update an object on the server. @@ -265,8 +277,8 @@ class UpdateMixin(object): else: new_data[attr_name] = type_obj.get_for_api() - return self.gitlab.http_put(path, post_data=new_data, files=files, - **kwargs) + http_method = self._get_update_method() + return http_method(path, post_data=new_data, files=files, **kwargs) class SetMixin(object): |