diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-02-21 23:38:33 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-02-21 23:38:33 +0000 |
| commit | 6cafd4b21f89523410c7d4c34740884c6a3552d8 (patch) | |
| tree | 103ae6223eb6f2c1d42199629ab7f9c76d85061d /django/template/__init__.py | |
| parent | 373be1ec1fb06974c29790d732180c395f98c28e (diff) | |
Fixed #7876 - Improved template error message to include expected end tag. Thanks to Matthias Kestenholz for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12460 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/template/__init__.py')
| -rw-r--r-- | django/template/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py index af033222a8..584b14b06f 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -56,7 +56,7 @@ from django.template.context import Context, RequestContext, ContextPopException from django.utils.importlib import import_module from django.utils.itercompat import is_iterable from django.utils.functional import curry, Promise -from django.utils.text import smart_split, unescape_string_literal +from django.utils.text import smart_split, unescape_string_literal, get_text_list from django.utils.encoding import smart_unicode, force_unicode, smart_str from django.utils.translation import ugettext as _ from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping @@ -288,7 +288,7 @@ class Parser(object): try: compile_func = self.tags[command] except KeyError: - self.invalid_block_tag(token, command) + self.invalid_block_tag(token, command, parse_until) try: compiled_result = compile_func(self, token) except TemplateSyntaxError, e: @@ -339,7 +339,9 @@ class Parser(object): def empty_block_tag(self, token): raise self.error(token, "Empty block tag") - def invalid_block_tag(self, token, command): + def invalid_block_tag(self, token, command, parse_until=None): + if parse_until: + raise self.error(token, "Invalid block tag: '%s', expected %s" % (command, get_text_list(["'%s'" % p for p in parse_until]))) raise self.error(token, "Invalid block tag: '%s'" % command) def unclosed_block_tag(self, parse_until): |
