check d object must be dict to get url or id

This commit is contained in:
Chaiwat Suttipongsakul 2019-01-25 22:46:54 +07:00
parent 19383ab9f3
commit f22e2c884c

3
app.py
View file

@ -285,9 +285,12 @@ def domain(url):
@app.template_filter()
def url_or_id(d):
if isinstance(d, dict):
if ("url" in d) and isinstance(d["url"], str):
return d["url"]
else:
return d["id"]
return ""
@app.template_filter()