check if a is a dict or string

This commit is contained in:
Chaiwat Suttipongsakul 2019-01-25 08:36:30 +07:00
parent ba220d59c9
commit 19383ab9f3

4
app.py
View file

@ -370,7 +370,9 @@ def _is_img(filename):
@app.template_filter() @app.template_filter()
def not_only_imgs(attachment): def not_only_imgs(attachment):
for a in attachment: for a in attachment:
if not _is_img(a["url"]): if isinstance(a, dict) and not _is_img(a["url"]):
return True
if isinstance(a, str) and not _is_img(a):
return True return True
return False return False