def render_body_as_html(self, ctx: T) -> SafeString:
html_ctx = self._cast_to_dict(ctx).copy()
html_ctx['is_html_email'] = True
html_ctx['is_plaintext_email'] = False
body = render_to_string(self.template_name, html_ctx)
# TODO: This is a workaround for
# https://github.com/18F/calc/issues/1409, need to figure
# out the exact reason behind it.
body = body.encode('ascii', 'xmlcharrefreplace').decode('ascii')
return SafeString(body)
评论列表
文章目录