diff options
| author | Barry Warsaw | 2015-04-07 15:21:08 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2015-04-07 15:21:08 -0400 |
| commit | 89f8cd6c2bc7d38c2478d87d81b4b729169b3d80 (patch) | |
| tree | 41ceebd7697d0673b9c91592c75c4ba85a8e432c /src/mailman/rest/validator.py | |
| parent | bf00467f633ae6a8523189c1b922ca6dcd6636b8 (diff) | |
| parent | 7317b94a0b746f0287ecbc5654ec544ce0112adb (diff) | |
| download | mailman-89f8cd6c2bc7d38c2478d87d81b4b729169b3d80.tar.gz mailman-89f8cd6c2bc7d38c2478d87d81b4b729169b3d80.tar.zst mailman-89f8cd6c2bc7d38c2478d87d81b4b729169b3d80.zip | |
Diffstat (limited to 'src/mailman/rest/validator.py')
| -rw-r--r-- | src/mailman/rest/validator.py | 9 |
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.""" |
