1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #15070 -- Also pass current_app and use_l10n in inclusion_tags. Thanks, raony, mk and goodtune.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel
2011-04-28 13:41:28 +00:00
parent 07854d1c44
commit 2ac4f175ec
5 changed files with 46 additions and 1 deletions

View File

@@ -78,3 +78,27 @@ class CustomTagTests(TestCase):
self.verify_tag(custom.inclusion_explicit_no_context, 'inclusion_explicit_no_context')
self.verify_tag(custom.inclusion_no_params_with_context, 'inclusion_no_params_with_context')
self.verify_tag(custom.inclusion_params_and_context, 'inclusion_params_and_context')
def test_15070_current_app(self):
"""
Test that inclusion tag passes down `current_app` of context to the
Context of the included/rendered template as well.
"""
c = template.Context({})
t = template.Template('{% load custom %}{% inclusion_tag_current_app %}')
self.assertEquals(t.render(c).strip(), u'None')
c.current_app = 'advanced'
self.assertEquals(t.render(c).strip(), u'advanced')
def test_15070_use_l10n(self):
"""
Test that inclusion tag passes down `use_l10n` of context to the
Context of the included/rendered template as well.
"""
c = template.Context({})
t = template.Template('{% load custom %}{% inclusion_tag_use_l10n %}')
self.assertEquals(t.render(c).strip(), u'None')
c.use_l10n = True
self.assertEquals(t.render(c).strip(), u'True')