diff options
author | Mateusz Filipowicz <mateusz.filipowicz@roche.com> | 2020-02-05 15:26:06 +0100 |
---|---|---|
committer | Mateusz Filipowicz <mateusz.filipowicz@roche.com> | 2020-02-07 11:00:18 +0100 |
commit | 1ec1816d7c76ae079ad3b3e3b7a1bae70e0dd95b (patch) | |
tree | 20a78c9ea8d2907bd3fbe83bb8b32db7dce4b5e5 /gitlab | |
parent | 7f192b4f8734e29a63f1c79be322c25d45cfe23f (diff) | |
download | gitlab-1ec1816d7c76ae079ad3b3e3b7a1bae70e0dd95b.tar.gz |
fix: remove null values from features POST data, because it fails
with HTTP 500
Diffstat (limited to 'gitlab')
-rw-r--r-- | gitlab/utils.py | 4 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/gitlab/utils.py b/gitlab/utils.py index 0992ed7..4241787 100644 --- a/gitlab/utils.py +++ b/gitlab/utils.py @@ -55,3 +55,7 @@ def sanitized_url(url): parsed = urlparse(url) new_path = parsed.path.replace(".", "%2E") return parsed._replace(path=new_path).geturl() + + +def remove_none_from_dict(data): + return {k: v for k, v in data.items() if v is not None} diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f18f733..ed65d7b 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -760,6 +760,7 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager): "group": group, "project": project, } + data = utils.remove_none_from_dict(data) server_data = self.gitlab.http_post(path, post_data=data, **kwargs) return self._obj_cls(self, server_data) |