summaryrefslogtreecommitdiff
path: root/src/mailman/rest/lists.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest/lists.py')
-rw-r--r--src/mailman/rest/lists.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py
index 9ed3f877e..6e297d0ed 100644
--- a/src/mailman/rest/lists.py
+++ b/src/mailman/rest/lists.py
@@ -264,14 +264,20 @@ class ListConfiguration(resource.Resource):
"""Set all of a mailing list's configuration."""
# Use PATCH to change just one or a few of the attributes.
validator = Validator(**VALIDATORS)
- for key, value in validator(request).items():
- setattr(self._mlist, key, value)
+ try:
+ for key, value in validator(request).items():
+ setattr(self._mlist, key, value)
+ except ValueError as error:
+ return http.bad_request([], str(error))
return http.ok([], '')
@PATCH()
def patch_configuration(self, request):
"""Set a subset of the mailing list's configuration."""
validator = Validator(_optional=VALIDATORS.keys(), **VALIDATORS)
- for key, value in validator(request).items():
- setattr(self._mlist, key, value)
+ try:
+ for key, value in validator(request).items():
+ setattr(self._mlist, key, value)
+ except ValueError as error:
+ return http.bad_request([], str(error))
return http.ok([], '')