diff options
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 41931ab..4f5a394 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -222,10 +222,10 @@ class GitlabObject(object): for attribute in attributes: if hasattr(self, attribute): value = getattr(self, attribute) - if isinstance(value, list): - if value and isinstance(value[0], six.string_types): - value = ",".join(value) - if attribute == 'sudo': + # labels need to be sent as a comma-separated list + if attribute == 'labels' and isinstance(value, list): + value = ", ".join(value) + elif attribute == 'sudo': value = str(value) data[attribute] = value @@ -764,6 +764,15 @@ class ApplicationSettings(GitlabObject): canCreate = False canDelete = False + def _data_for_gitlab(self, extra_parameters={}, update=False, + as_json=True): + data = (super(ApplicationSettings, self) + ._data_for_gitlab(extra_parameters, update=update, + as_json=False)) + if not self.domain_whitelist: + data.pop('domain_whitelist', None) + return json.dumps(data) + class ApplicationSettingsManager(BaseManager): obj_cls = ApplicationSettings @@ -1458,19 +1467,6 @@ class ProjectIssue(GitlabObject): [('project_id', 'project_id'), ('issue_id', 'id')]), ) - def _data_for_gitlab(self, extra_parameters={}, update=False, - as_json=True): - # Gitlab-api returns labels in a json list and takes them in a - # comma separated list. - if hasattr(self, "labels"): - if (self.labels is not None and - not isinstance(self.labels, six.string_types)): - labels = ", ".join(self.labels) - extra_parameters['labels'] = labels - - return super(ProjectIssue, self)._data_for_gitlab(extra_parameters, - update) - def subscribe(self, **kwargs): """Subscribe to an issue. |