Skip to content

Commit

Permalink
Remove empty string validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vinikvuo committed Aug 23, 2023
1 parent 5f0d05a commit 86b3e0e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion forms/validators/answer.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def regex_validator(

if section_identifier is not None:
for entry in entries:
if isinstance(entries[entry], str) or entry in ("value", "extraValue"):
continue

self.regex_checker(entries, entry, regex_fields, section_identifier)
for entry in entries:
section_identifier = re.sub(r"\[\d+]", "", entry)
Expand All @@ -85,10 +88,13 @@ def regex_validator(
)

def regex_checker(self, entries, entry, regex_fields, section_identifier):
regex_exists = bool(re.search(self._regex, entries[entry]["value"]))
if regex_fields.filter(
section__identifier=section_identifier, identifier=entry
).exists():
if entries[entry]["value"] == "":
return

regex_exists = bool(re.search(self._regex, entries[entry]["value"]))
if regex_exists and self._identifier == "henkilotunnus":
self.ssn_checker(entries[entry]["value"])
if not regex_exists:
Expand Down

0 comments on commit 86b3e0e

Please sign in to comment.