AetherUnbound commented on a change in pull request #5673: [AIRFLOW-4451] Allow
templated named tuples
URL: https://github.com/apache/airflow/pull/5673#discussion_r308275194
##########
File path: airflow/models/baseoperator.py
##########
@@ -646,6 +646,9 @@ def render_template_from_field(self, attr, content,
context, jinja_env):
rt = self.render_template
if isinstance(content, str):
result = jinja_env.from_string(content).render(**context)
+ # Special case for named tuples
+ elif isinstance(content, tuple) and type(content) is not tuple:
+ result = content.__class__(*(rt(attr, e, context) for e in
content))
Review comment:
That sounds good, but I think that the second `else` should then return a
tuple too, since we're distinguishing that case from the list already.
----------------------------------------------------------------
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]
With regards,
Apache Git Services