Ignore wrong formatted row

This commit is contained in:
Son NK 2020-09-11 16:51:04 +02:00
parent 76175dc517
commit d14f6cf7fb
1 changed files with 6 additions and 2 deletions

View File

@ -102,8 +102,12 @@ def handle_batch_import(batch_import: BatchImport):
reader = csv.DictReader(lines)
for row in reader:
full_alias = row["alias"].lower().strip().replace(" ", "")
note = row["note"]
try:
full_alias = row["alias"].lower().strip().replace(" ", "")
note = row["note"]
except KeyError:
LOG.warning("Cannot parse row %s", row)
continue
alias_domain = get_email_domain_part(full_alias)
custom_domain = CustomDomain.get_by(domain=alias_domain)