Skip to content

Commit

Permalink
Merge pull request #2659 from carpentries/bugfix/Jinja2-issue-when-re…
Browse files Browse the repository at this point in the history
…ndering-for-email-update

[Emails] Fix template render issue with email update actions
  • Loading branch information
pbanaszkiewicz authored Jun 12, 2024
2 parents d143fe7 + 50168ca commit ca733cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions amy/emails/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@ def update_scheduled_email(
# Try rendering the templates with empty context to see if there are any syntax
# errors.
engine = EmailTemplate.get_engine()
EmailTemplate.render_template(engine, template.subject, {})
EmailTemplate.render_template(engine, template.body, {})
try:
EmailTemplate.render_template(engine, template.subject, {})
except jinja2.exceptions.UndefinedError:
pass
try:
EmailTemplate.render_template(engine, template.body, {})
except jinja2.exceptions.UndefinedError:
pass

subject = template.subject
body = template.body
Expand Down

0 comments on commit ca733cd

Please sign in to comment.