From 19383ab9f3ad36fab4715114b374af98a1edecb4 Mon Sep 17 00:00:00 2001 From: Chaiwat Suttipongsakul Date: Fri, 25 Jan 2019 08:36:30 +0700 Subject: [PATCH] check if a is a dict or string --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index b09a491..ec0eb55 100644 --- a/app.py +++ b/app.py @@ -370,7 +370,9 @@ def _is_img(filename): @app.template_filter() def not_only_imgs(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 False