Skip to content

Commit 911401c

Browse files
committed
fix app if no email address
1 parent 0f2be97 commit 911401c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ def render_template(template, dataset):
5959
if template == "view.html":
6060
kwargs["title"] = f"{kwargs['title']} - AIFARMS Data Portal"
6161
if isinstance(kwargs.get("contact"), str):
62-
name, email = kwargs["contact"].split("<")
63-
kwargs["contact"] = {"name": name.strip(), "email": email.strip(" >")}
62+
if "<" in kwargs["contact"]:
63+
name, email = kwargs["contact"].split("<")
64+
kwargs["contact"] = {"name": name.strip(), "email": email.strip(" >")}
65+
else:
66+
kwargs["contact"] = {"name": kwargs["contact"].strip(), "email": ""}
6467

6568
zipfile = f"{DATASETS}/{data[dataset]['uuid']}.zip"
6669
if os.path.exists(zipfile):

0 commit comments

Comments
 (0)