summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/othertests/templates.py25
-rw-r--r--tests/testapp/templatetags/__init__.py0
-rw-r--r--tests/testapp/templatetags/testtags.py17
3 files changed, 24 insertions, 18 deletions
diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py
index 86a67bea67..a92fc5ef00 100644
--- a/tests/othertests/templates.py
+++ b/tests/othertests/templates.py
@@ -8,7 +8,30 @@ from django.core.template import loader
from django.utils.translation import activate, deactivate, install
import traceback
-# Helper objects for template tests
+#################################
+# Custom template tag for tests #
+#################################
+
+register = template.Library()
+
+class EchoNode(template.Node):
+ def __init__(self, contents):
+ self.contents = contents
+
+ def render(self, context):
+ return " ".join(self.contents)
+
+def do_echo(parser, token):
+ return EchoNode(token.contents.split()[1:])
+
+register.tag("echo", do_echo)
+
+template.libraries['django.templatetags.testtags'] = register
+
+#####################################
+# Helper objects for template tests #
+#####################################
+
class SomeClass:
def __init__(self):
self.otherclass = OtherClass()
diff --git a/tests/testapp/templatetags/__init__.py b/tests/testapp/templatetags/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/testapp/templatetags/__init__.py
+++ /dev/null
diff --git a/tests/testapp/templatetags/testtags.py b/tests/testapp/templatetags/testtags.py
deleted file mode 100644
index e9177d8c24..0000000000
--- a/tests/testapp/templatetags/testtags.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Custom tag library used in conjunction with template tests
-
-from django.core import template
-
-register = template.Library()
-
-class EchoNode(template.Node):
- def __init__(self, contents):
- self.contents = contents
-
- def render(self, context):
- return " ".join(self.contents)
-
-def do_echo(parser, token):
- return EchoNode(token.contents.split()[1:])
-
-register.tag("echo", do_echo) \ No newline at end of file