mirror of https://github.com/django/django.git
Fixed #3100 -- Added support for arguments on intermediate tag tokens.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
718a5ba1a1
commit
959f78b3c6
|
@ -250,15 +250,15 @@ class Parser(object):
|
|||
var_node = self.create_variable_node(filter_expression)
|
||||
self.extend_nodelist(nodelist, var_node, token)
|
||||
elif token.token_type == TOKEN_BLOCK:
|
||||
if token.contents in parse_until:
|
||||
# put token back on token list so calling
|
||||
# code knows why it terminated
|
||||
self.prepend_token(token)
|
||||
return nodelist
|
||||
try:
|
||||
command = token.contents.split()[0]
|
||||
except IndexError:
|
||||
self.empty_block_tag(token)
|
||||
if command in parse_until:
|
||||
# put token back on token list so calling
|
||||
# code knows why it terminated
|
||||
self.prepend_token(token)
|
||||
return nodelist
|
||||
# execute callback function for this tag and append
|
||||
# resulting node
|
||||
self.enter_command(command, token)
|
||||
|
|
|
@ -189,8 +189,14 @@ def do_block(parser, token):
|
|||
parser.__loaded_blocks.append(block_name)
|
||||
except AttributeError: # parser.__loaded_blocks isn't a list yet
|
||||
parser.__loaded_blocks = [block_name]
|
||||
nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
|
||||
parser.delete_first_token()
|
||||
nodelist = parser.parse(('endblock',))
|
||||
|
||||
# This check is kept for backwards-compatibility. See #3100.
|
||||
endblock = parser.next_token()
|
||||
acceptable_endblocks = ('endblock', 'endblock %s' % block_name)
|
||||
if endblock.contents not in acceptable_endblocks:
|
||||
parser.invalid_block_tag(endblock, 'endblock', acceptable_endblocks)
|
||||
|
||||
return BlockNode(block_name, nodelist)
|
||||
|
||||
@register.tag('extends')
|
||||
|
|
Loading…
Reference in New Issue