summaryrefslogtreecommitdiff
path: root/src/mailman/rest/validator.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-04-06 22:06:28 -0400
committerBarry Warsaw2015-04-06 22:06:28 -0400
commit7317b94a0b746f0287ecbc5654ec544ce0112adb (patch)
treefd113090d48ba1901e125d156239f17d1ddad4c7 /src/mailman/rest/validator.py
parentb0a841d634ad5a44b44af17548636e17c38541f1 (diff)
parent5f16bf4ee68231cdce99ed26262f73cac81fbafa (diff)
downloadmailman-7317b94a0b746f0287ecbc5654ec544ce0112adb.tar.gz
mailman-7317b94a0b746f0287ecbc5654ec544ce0112adb.tar.zst
mailman-7317b94a0b746f0287ecbc5654ec544ce0112adb.zip
* Domains now have a list of owners, which are ``IUser`` objects, instead of
the single ``contact_address`` they used to have. ``IUser`` objects now also have a ``is_server_owner`` flag (defaulting to False) to indicate whether they have superuser privileges. Give by Abhliash Raj, with fixes and refinements by Barry Warsaw. (LP: #1423756) * Domains can now optionally be created with owners; domain owners can be added after the fact; domain owners can be deleted. Also, users now have an ``is_server_owner`` flag as part of their representation, which defaults to False, and can be PUT and PATCH'd. Given by Abhilash Raj, with fixes and refinements by Barry Warsaw. (LP: #1423756)
Diffstat (limited to 'src/mailman/rest/validator.py')
-rw-r--r--src/mailman/rest/validator.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mailman/rest/validator.py b/src/mailman/rest/validator.py
index 867991a36..d09886e36 100644
--- a/src/mailman/rest/validator.py
+++ b/src/mailman/rest/validator.py
@@ -22,6 +22,7 @@ __all__ = [
'Validator',
'enum_validator',
'language_validator',
+ 'list_of_strings_validator',
'subscriber_validator',
]
@@ -66,6 +67,14 @@ def language_validator(code):
return getUtility(ILanguageManager)[code]
+def list_of_strings_validator(values):
+ """Turn a list of things into a list of unicodes."""
+ for value in values:
+ if not isinstance(value, str):
+ raise ValueError('Expected str, got {!r}'.format(value))
+ return values
+
+
class Validator:
"""A validator of parameter input."""