Handle empty values for ConfirmQuit conftype.

This commit is contained in:
Florian Bruhin 2015-07-21 13:00:01 +02:00
parent e81ac925d7
commit 1b643ff55f

View File

@ -1372,8 +1372,14 @@ class ConfirmQuit(List):
def validate(self, value): def validate(self, value):
values = self.transform(value) values = self.transform(value)
if not value:
if self._none_ok:
return None
else:
raise configexc.ValidationError(
value, "Value may not be empty!")
# Never can't be set with other options # Never can't be set with other options
if 'never' in values and len(values) > 1: elif 'never' in values and len(values) > 1:
raise configexc.ValidationError( raise configexc.ValidationError(
value, "List cannot contain never!") value, "List cannot contain never!")
# Always can't be set with other options # Always can't be set with other options