YangMuye commented on a change in pull request #14024:
URL: https://github.com/apache/airflow/pull/14024#discussion_r568615162



##########
File path: airflow/www/views.py
##########
@@ -898,7 +898,7 @@ def rendered_templates(self):
             content = getattr(task, template_field)
             renderer = task.template_fields_renderers.get(template_field, 
template_field)
             if renderer in renderers:
-                if isinstance(content, (dict, list)):
+                if isinstance(content, dict):

Review comment:
       How about this? Actually I am even thinking whether a field accepts a 
list or not is also decided by the Operator...
   
   ```diff
   def get_attr_renderer():
       """Return Dictionary containing different Pygments Lexers for Rendering 
& Highlighting"""
       return {
   -        'json': lambda x: render(x, lexers.JsonLexer),
   +        'json': lambda x: render(x if isinstance(content, (dict, list)) 
else json.dumps(x), lexers.JsonLexer, False),
   -        'yaml': lambda x: render(x, lexers.YamlLexer),
   +        'yaml': lambda x: render(x if isinstance(content, (dict, list)) 
else json.dumps(x), lexers.YamlLexer, False),
   
           'py': lambda x: render(get_python_source(x), lexers.PythonLexer),
   
       }
   ```
   
   python fields are already doing similar transformation.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to