summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2011-11-21 10:28:12 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2011-11-21 10:28:12 +0000
commitc5a899b190d1afa798efade499e8d00a5286fa28 (patch)
tree3be4704f57848c3696e895ea6e4a79ed792a5ef8 /tests
parent19e54084dc7d85d0bf190e0d79575126c5d29a50 (diff)
Fixed #16787 -- Restored the ability to {% load %} template tags libraries within packages. Thanks Ivan Sagalaev for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/templates/templatetags/subpackage/__init__.py0
-rw-r--r--tests/regressiontests/templates/templatetags/subpackage/echo.py7
-rw-r--r--tests/regressiontests/templates/templatetags/subpackage/echo_invalid.py1
-rw-r--r--tests/regressiontests/templates/tests.py19
4 files changed, 20 insertions, 7 deletions
diff --git a/tests/regressiontests/templates/templatetags/subpackage/__init__.py b/tests/regressiontests/templates/templatetags/subpackage/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/regressiontests/templates/templatetags/subpackage/__init__.py
diff --git a/tests/regressiontests/templates/templatetags/subpackage/echo.py b/tests/regressiontests/templates/templatetags/subpackage/echo.py
new file mode 100644
index 0000000000..0e4e862887
--- /dev/null
+++ b/tests/regressiontests/templates/templatetags/subpackage/echo.py
@@ -0,0 +1,7 @@
+from django import template
+
+register = template.Library()
+
+@register.simple_tag
+def echo2(arg):
+ return arg
diff --git a/tests/regressiontests/templates/templatetags/subpackage/echo_invalid.py b/tests/regressiontests/templates/templatetags/subpackage/echo_invalid.py
new file mode 100644
index 0000000000..c12ea65507
--- /dev/null
+++ b/tests/regressiontests/templates/templatetags/subpackage/echo_invalid.py
@@ -0,0 +1 @@
+import nonexistent.module
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index 712093b934..e2743581ae 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -1193,17 +1193,22 @@ class Templates(unittest.TestCase):
'inheritance41': ("{% extends 'inheritance36' %}{% block opt %}new{{ block.super }}{% endblock %}", {'numbers': '123'}, '_new1_new2_new3_'),
### LOADING TAG LIBRARIES #################################################
+ 'load01': ("{% load testtags subpackage.echo %}{% echo test %} {% echo2 \"test\" %}", {}, "test test"),
+ 'load02': ("{% load subpackage.echo %}{% echo2 \"test\" %}", {}, "test"),
# {% load %} tag, importing individual tags
- 'load1': ("{% load echo from testtags %}{% echo this that theother %}", {}, 'this that theother'),
- 'load2': ("{% load echo other_echo from testtags %}{% echo this that theother %} {% other_echo and another thing %}", {}, 'this that theother and another thing'),
- 'load3': ("{% load echo upper from testtags %}{% echo this that theother %} {{ statement|upper }}", {'statement': 'not shouting'}, 'this that theother NOT SHOUTING'),
+ 'load03': ("{% load echo from testtags %}{% echo this that theother %}", {}, 'this that theother'),
+ 'load04': ("{% load echo other_echo from testtags %}{% echo this that theother %} {% other_echo and another thing %}", {}, 'this that theother and another thing'),
+ 'load05': ("{% load echo upper from testtags %}{% echo this that theother %} {{ statement|upper }}", {'statement': 'not shouting'}, 'this that theother NOT SHOUTING'),
+ 'load06': ("{% load echo2 from subpackage.echo %}{% echo2 \"test\" %}", {}, "test"),
# {% load %} tag errors
- 'load4': ("{% load echo other_echo bad_tag from testtags %}", {}, template.TemplateSyntaxError),
- 'load5': ("{% load echo other_echo bad_tag from %}", {}, template.TemplateSyntaxError),
- 'load6': ("{% load from testtags %}", {}, template.TemplateSyntaxError),
- 'load7': ("{% load echo from bad_library %}", {}, template.TemplateSyntaxError),
+ 'load07': ("{% load echo other_echo bad_tag from testtags %}", {}, template.TemplateSyntaxError),
+ 'load08': ("{% load echo other_echo bad_tag from %}", {}, template.TemplateSyntaxError),
+ 'load09': ("{% load from testtags %}", {}, template.TemplateSyntaxError),
+ 'load10': ("{% load echo from bad_library %}", {}, template.TemplateSyntaxError),
+ 'load11': ("{% load subpackage.echo_invalid %}", {}, template.TemplateSyntaxError),
+ 'load12': ("{% load subpackage.missing %}", {}, template.TemplateSyntaxError),
### I18N ##################################################################