summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/files.py
diff options
context:
space:
mode:
authorWalter Rowe <walter.rowe@gmail.com>2022-05-31 15:36:14 -0400
committerGitHub <noreply@github.com>2022-05-31 21:36:14 +0200
commit3fa330cc341bbedb163ba757c7f6578d735c6efb (patch)
tree6a27d234a22e77233990ba89991aa41d438c2528 /gitlab/v4/objects/files.py
parent37eb8e0a4f0fd5fc7e221163b84df3461e64475b (diff)
downloadgitlab-3fa330cc341bbedb163ba757c7f6578d735c6efb.tar.gz
feat: support mutually exclusive attributes and consolidate validation to fix board lists (#2037)
add exclusive tuple to RequiredOptional data class to support for mutually exclusive attributes consolidate _check_missing_create_attrs and _check_missing_update_attrs from mixins.py into _validate_attrs in utils.py change _create_attrs in board list manager classes from required=('label_ld',) to exclusive=('label_id','asignee_id','milestone_id') closes https://github.com/python-gitlab/python-gitlab/issues/1897
Diffstat (limited to 'gitlab/v4/objects/files.py')
-rw-r--r--gitlab/v4/objects/files.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py
index c0b7261..b80d129 100644
--- a/gitlab/v4/objects/files.py
+++ b/gitlab/v4/objects/files.py
@@ -145,7 +145,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
if TYPE_CHECKING:
assert data is not None
- self._check_missing_create_attrs(data)
+ utils._validate_attrs(data=data, attributes=self._create_attrs)
new_data = data.copy()
file_path = utils.EncodedId(new_data.pop("file_path"))
path = f"{self.path}/{file_path}"
@@ -179,7 +179,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
file_path = utils.EncodedId(file_path)
data["file_path"] = file_path
path = f"{self.path}/{file_path}"
- self._check_missing_update_attrs(data)
+ utils._validate_attrs(data=data, attributes=self._update_attrs)
result = self.gitlab.http_put(path, post_data=data, **kwargs)
if TYPE_CHECKING:
assert isinstance(result, dict)