summaryrefslogtreecommitdiff
path: root/src/mailman/rest/validator.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-07-12 19:37:53 -0400
committerBarry Warsaw2016-07-12 19:37:53 -0400
commit9e7bab1de942a96b5da007ebba4b35a64f01cfd3 (patch)
treea77248da45d52d768cee3c60c46054706e8a9a00 /src/mailman/rest/validator.py
parent5ef33f7509f8c716f6aee30539fafaccbbab7fed (diff)
downloadmailman-9e7bab1de942a96b5da007ebba4b35a64f01cfd3.tar.gz
mailman-9e7bab1de942a96b5da007ebba4b35a64f01cfd3.tar.zst
mailman-9e7bab1de942a96b5da007ebba4b35a64f01cfd3.zip
Diffstat (limited to 'src/mailman/rest/validator.py')
-rw-r--r--src/mailman/rest/validator.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mailman/rest/validator.py b/src/mailman/rest/validator.py
index 0a6184850..bcc6b3321 100644
--- a/src/mailman/rest/validator.py
+++ b/src/mailman/rest/validator.py
@@ -52,14 +52,14 @@ class ReadOnlyPATCHRequestError(RESTError):
class enum_validator:
"""Convert an enum value name into an enum value."""
- def __init__(self, enum_class, allow_none=False):
+ def __init__(self, enum_class, *, allow_blank=False):
self._enum_class = enum_class
- self._allow_none = allow_none
+ self._allow_blank = allow_blank
def __call__(self, enum_value):
# This will raise a KeyError if the enum value is unknown. The
# Validator API requires turning this into a ValueError.
- if self._allow_none and not enum_value:
+ if not enum_value and self._allow_blank:
return None
try:
return self._enum_class[enum_value]