diff options
| author | Preston Timmons <prestontimmons@gmail.com> | 2015-03-06 09:53:25 -0600 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-20 08:58:07 -0400 |
| commit | 55f12f8709f0604df7e1817a4c114ead1fb9a311 (patch) | |
| tree | 44ad572e4735406d1de94341389d955a8dbc1553 /tests/template_tests/test_parser.py | |
| parent | eb5ebcc2d0b13737127e3478bced98a84962a5d0 (diff) | |
Cleaned up the template debug implementation.
This patch does three major things:
* Merges the django.template.debug implementation into django.template.base.
* Simplifies the debug implementation.
The old implementation copied debug information to every token and node.
The django_template_source attribute was set in multiple places, some
quite hacky, like django.template.defaulttags.ForNode.
Debug information is now annotated in two high-level places:
* Template.compile_nodelist for errors during parsing
* Node.render_annotated for errors during rendering
These were chosen because they have access to the template and context
as well as to all exceptions that happen during either the parse or
render phase.
* Moves the contextual line traceback information creation from
django.views.debug into django.template.base.Template. The debug views now
only deal with the presentation of the debug information.
Diffstat (limited to 'tests/template_tests/test_parser.py')
| -rw-r--r-- | tests/template_tests/test_parser.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py index a88dec285e..dd22c83836 100644 --- a/tests/template_tests/test_parser.py +++ b/tests/template_tests/test_parser.py @@ -5,11 +5,10 @@ from __future__ import unicode_literals from unittest import TestCase -from django.template import Library, Template, TemplateSyntaxError +from django.template import Library, TemplateSyntaxError from django.template.base import ( TOKEN_BLOCK, FilterExpression, Parser, Token, Variable, ) -from django.test import override_settings from django.utils import six @@ -73,14 +72,6 @@ class ParserTests(TestCase): with six.assertRaisesRegex(self, TypeError, "Variable must be a string or number, got <(class|type) 'dict'>"): Variable({}) - @override_settings(DEBUG=True) - def test_compile_filter_error(self): - # regression test for #19819 - msg = "Could not parse the remainder: '@bar' from 'foo@bar'" - with six.assertRaisesRegex(self, TemplateSyntaxError, msg) as cm: - Template("{% if 1 %}{{ foo@bar }}{% endif %}") - self.assertEqual(cm.exception.django_template_source[1], (10, 23)) - def test_filter_args_count(self): p = Parser("") l = Library() |
