1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #33631 -- Marked {% blocktranslate asvar %} result as HTML safe.

This commit is contained in:
cheng
2022-07-13 23:11:17 -07:00
committed by Mariusz Felisiak
parent 7faf25d682
commit d4c5d2b52c
4 changed files with 26 additions and 2 deletions

View File

@@ -416,6 +416,22 @@ class I18nBlockTransTagTests(SimpleTestCase):
output = self.engine.render_to_string("i18n41")
self.assertEqual(output, ">Error: Seite nicht gefunden<")
@setup(
{
"i18n_asvar_safestring": (
"{% load i18n %}"
"{% blocktranslate asvar the_title %}"
"{{title}}other text"
"{% endblocktranslate %}"
"{{ the_title }}"
)
}
)
def test_i18n_asvar_safestring(self):
context = {"title": "<Main Title>"}
output = self.engine.render_to_string("i18n_asvar_safestring", context=context)
self.assertEqual(output, "&lt;Main Title&gt;other text")
@setup(
{
"template": (