summaryrefslogtreecommitdiff
path: root/src/mailman/rest/validator.py
diff options
context:
space:
mode:
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]