Fix _validate_valid_values
This commit is contained in:
parent
231b7303f5
commit
26bf588fad
@ -141,17 +141,11 @@ class BaseType:
|
|||||||
Args:
|
Args:
|
||||||
value: The value to validate.
|
value: The value to validate.
|
||||||
"""
|
"""
|
||||||
# FIXME:conf still needed?
|
|
||||||
if not value:
|
|
||||||
return
|
|
||||||
if self.valid_values is not None:
|
if self.valid_values is not None:
|
||||||
if value not in self.valid_values:
|
if value not in self.valid_values:
|
||||||
raise configexc.ValidationError(
|
raise configexc.ValidationError(
|
||||||
value,
|
value,
|
||||||
"valid values: {}".format(', '.join(self.valid_values)))
|
"valid values: {}".format(', '.join(self.valid_values)))
|
||||||
else:
|
|
||||||
raise NotImplementedError("{} does not implement validate.".format(
|
|
||||||
self.__class__.__name__))
|
|
||||||
|
|
||||||
def from_str(self, value):
|
def from_str(self, value):
|
||||||
"""Get the setting value from a string.
|
"""Get the setting value from a string.
|
||||||
|
Loading…
Reference in New Issue
Block a user