From 4a377007f6b8166ef482ee4afa8a76074be8c379 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Mon, 21 Jan 2019 15:52:56 -0500 Subject: [PATCH] Update mixedContentToJson filter to be more general --- atst/filters.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/atst/filters.py b/atst/filters.py index 1c368aee..da7047b3 100644 --- a/atst/filters.py +++ b/atst/filters.py @@ -54,12 +54,11 @@ def mixedContentToJson(value): This coerces the file upload in form data to its filename so that the data can be JSON serialized. """ - if ( - isinstance(value, dict) - and "legacy_task_order" in value - and hasattr(value["legacy_task_order"]["pdf"], "filename") - ): - value["legacy_task_order"]["pdf"] = value["legacy_task_order"]["pdf"].filename + if isinstance(value, dict): + for k, v in value.items(): + if hasattr(v, "filename"): + value[k] = v.filename + return app.jinja_env.filters["tojson"](value)