This is an automated email from the ASF dual-hosted git repository.

jhtimmins pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 66897eb5a0c497ed552f482fb133ffdb12272594
Author: Vladimir Aranovsky <[email protected]>
AuthorDate: Mon Jul 19 22:22:42 2021 +0300

    #16976 Add json.dumps() for templated fields objects: 'dict' and 'list' 
(#17082)
    
    (cherry picked from commit 1a0730a08f2d72cd71447b6d6549ec10d266dd6a)
---
 airflow/www/views.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/airflow/www/views.py b/airflow/www/views.py
index 740a767..1e578d4 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -972,6 +972,8 @@ class Airflow(AirflowBaseView):
             content = getattr(task, template_field)
             renderer = task.template_fields_renderers.get(template_field, 
template_field)
             if renderer in renderers:
+                if isinstance(content, (dict, list)):
+                    content = json.dumps(content, sort_keys=True, indent=4)
                 html_dict[template_field] = renderers[renderer](content)
             else:
                 html_dict[template_field] = 
Markup("<pre><code>{}</pre></code>").format(pformat(content))

Reply via email to