diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-10-14 20:10:13 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-10-14 20:10:13 +0000 |
| commit | f71f8546283dbdf698c7578f8f9154045c84f9e7 (patch) | |
| tree | 1ae0aa237970d1b67ec8504d9f3f425305b3e155 /tests | |
| parent | b773bf45c3011dc95617dcbec9584c8d139c27cc (diff) | |
Fixed #626 -- Moved template modules to django.core.template package. django.core.template_loader is deprecated, in favor of django.core.template.loader.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/othertests/templates.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index fb96cfeadd..f2da069ea2 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -1,4 +1,5 @@ -from django.core import template, template_loader +from django.core import template +from django.core.template import loader # Helper objects for template tests class SomeClass: @@ -216,7 +217,7 @@ TEMPLATE_TESTS = { 'exception04': ("{% extends 'inheritance17' %}{% block first %}{% echo 400 %}5678{% endblock %}", {}, template.TemplateSyntaxError), } -# This replaces the standard template_loader. +# This replaces the standard template loader. def test_template_loader(template_name, template_dirs=None): try: return TEMPLATE_TESTS[template_name][0] @@ -224,13 +225,13 @@ def test_template_loader(template_name, template_dirs=None): raise template.TemplateDoesNotExist, template_name def run_tests(verbosity=0, standalone=False): - template_loader.load_template_source, old_template_loader = test_template_loader, template_loader.load_template_source + loader.load_template_source, old_template_loader = test_template_loader, loader.load_template_source failed_tests = [] tests = TEMPLATE_TESTS.items() tests.sort() for name, vals in tests: try: - output = template_loader.get_template(name).render(template.Context(vals[1])) + output = loader.get_template(name).render(template.Context(vals[1])) except Exception, e: if e.__class__ == vals[2]: if verbosity: @@ -247,7 +248,7 @@ def run_tests(verbosity=0, standalone=False): if verbosity: print "Template test: %s -- FAILED. Expected %r, got %r" % (name, vals[2], output) failed_tests.append(name) - template_loader.load_template_source = old_template_loader + loader.load_template_source = old_template_loader if failed_tests and not standalone: msg = "Template tests %s failed." % failed_tests |
