[fix) Pattern and empty string

This commit is contained in:
ljf 2021-09-16 03:13:32 +02:00
parent 3efa2fe751
commit 1b47859d37

View file

@ -526,7 +526,7 @@ class Question(object):
raise YunohostValidationError("app_argument_required", name=self.name) raise YunohostValidationError("app_argument_required", name=self.name)
# we have an answer, do some post checks # we have an answer, do some post checks
if self.value is not None: if self.value not in [None, ""]:
if self.choices and self.value not in self.choices: if self.choices and self.value not in self.choices:
self._raise_invalid_answer() self._raise_invalid_answer()
if self.pattern and not re.match(self.pattern["regexp"], str(self.value)): if self.pattern and not re.match(self.pattern["regexp"], str(self.value)):