summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/template/__init__.py7
-rw-r--r--django/core/template/defaulttags.py3
2 files changed, 8 insertions, 2 deletions
diff --git a/django/core/template/__init__.py b/django/core/template/__init__.py
index 60bb5e0888..6298ce24b9 100644
--- a/django/core/template/__init__.py
+++ b/django/core/template/__init__.py
@@ -311,6 +311,13 @@ class Parser(object):
self.unclosed_block_tag(parse_until)
return nodelist
+ def skip_past(self, endtag):
+ while self.tokens:
+ token = self.next_token()
+ if token.token_type == TOKEN_BLOCK and token.contents == endtag:
+ return
+ self.unclosed_block_tag([endtag])
+
def create_variable_node(self, filter_expression):
return VariableNode(filter_expression)
diff --git a/django/core/template/defaulttags.py b/django/core/template/defaulttags.py
index c11a67838a..518498664d 100644
--- a/django/core/template/defaulttags.py
+++ b/django/core/template/defaulttags.py
@@ -286,8 +286,7 @@ def comment(parser, token):
"""
Ignore everything between ``{% comment %}`` and ``{% endcomment %}``
"""
- nodelist = parser.parse(('endcomment',))
- parser.delete_first_token()
+ parser.skip_past('endcomment')
return CommentNode()
comment = register.tag(comment)