You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/06 19:01:24 UTC
[GitHub] [airflow] dstandish commented on a diff in pull request #22770: Fix `email_on_failure` with `render_template_as_native_obj`
dstandish commented on code in PR #22770:
URL: https://github.com/apache/airflow/pull/22770#discussion_r844294612
##########
airflow/models/taskinstance.py:
##########
@@ -2196,7 +2196,7 @@ def get_email_subject_content(self, exception: BaseException) -> Tuple[str, str,
html_content_err = jinja_env.from_string(default_html_content_err).render(**default_context)
else:
- jinja_env = self.task.get_template_env()
+ jinja_env = self.task.get_template_env(force_sandboxed=True)
Review Comment:
i think you may need to update this operator to handle kwargs
https://github.com/apache/airflow/blob/be0a4e413117c5ceb0a245402cdfabe1a3d82ace/airflow/providers/microsoft/psrp/operators/psrp.py#L158
also, this illustrates a backcompat issue if a user implemented this method (since it's a signature change).
if we wanted to be real careful we could inspect the signature before calling....
wdyt?
##########
tests/models/test_dag.py:
##########
@@ -473,6 +474,18 @@ def test_template_undefined(self):
jinja_env = dag.get_template_env()
assert jinja_env.undefined is jinja2.Undefined
+ @parameterized.expand(
+ [
+ (False, False, SandboxedEnvironment),
Review Comment:
```suggestion
(False, True, SandboxedEnvironment),
(False, False, SandboxedEnvironment),
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org