Rendered Templates - py renderer doesn't work for list or dict
See original GitHub issueApache Airflow version: 2.1.1
What happened:
The rendered templates screen doesn’t show the operator arguments for TaskFlow API operators.
What you expected to happen:
Should show the arguments after any templates have been rendered.
How to reproduce it:
Will happen for any @task
decorated operator.
Anything else we need to know:
This issue appears on a number of operators. Possible solution is to modify the “get_python_source” in utils/code_utils.py to handle list and dict. This would cause any operator that using py as the renderer to handle lists and dicts. Possibly something like:
if isinstance(x, list):
return [str(v) for v in x]
if isinstance(x, dict):
return {k: str(v) for k, v in x.items()}
The converting values to strings seems necessary in order to avoid errors when this is passed to the pygments lexer.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Django render doesn't seem to pass dictionary to template
It looks like your template expects results2 to be a list of dicts, while you're passing a single dict.
Read more >Django shortcut functions
Combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text. Django does not provide a...
Read more >Primer on Jinja Templating - Real Python
Render the template: Fill the placeholders with content. You can provide a dictionary or keyword arguments as context. In this case, you've ...
Read more >Renderers - Django REST framework
The TemplateHTMLRenderer will create a RequestContext , using the response.data as the context dict, and determine a template name to use to render...
Read more >Rendering a String, List & Dictionary in Flask
When rendering a string, list, or dictionary in HTML from within a Flask app, you need to pass the variables from Python to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, of course. I will make PR tomorrow ASAP since this bug is completely affects my project.
@brain-buster - would you like to make a PR to fix the issue maybe ?