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

[1.5.x] Change exception type to reduce confusion.

TemplateSyntaxError is expected at compile time, not at run time.

Refs #19280.

Backport of 7644800.
This commit is contained in:
Aymeric Augustin
2012-11-25 19:51:42 +01:00
parent 72231610b3
commit 37c54c27bd
2 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ except ImportError: # Python 2
from django import template
from django.template import (base as template_base, Context, RequestContext,
Template, TemplateSyntaxError)
Template)
from django.core import urlresolvers
from django.template import loader
from django.template.loaders import app_directories, filesystem, cached
@@ -369,7 +369,7 @@ class Templates(TestCase):
# Regression test for #19280
t = Template('{% url path.to.view %}') # not quoted = old syntax
c = Context()
with self.assertRaisesRegexp(TemplateSyntaxError,
with self.assertRaisesRegexp(urlresolvers.NoReverseMatch,
"The syntax changed in Django 1.5, see the docs."):
t.render(c)