Ticket #3100: 3100-backwards-compatible.patch
File 3100-backwards-compatible.patch, 2.1 KB (added by , 13 years ago) |
---|
-
django/template/base.py
250 250 var_node = self.create_variable_node(filter_expression) 251 251 self.extend_nodelist(nodelist, var_node, token) 252 252 elif token.token_type == TOKEN_BLOCK: 253 if token.contents in parse_until: 253 try: 254 command = token.contents.split()[0] 255 except IndexError: 256 self.empty_block_tag(token) 257 if command in parse_until: 254 258 # put token back on token list so calling 255 259 # code knows why it terminated 256 260 self.prepend_token(token) 257 261 return nodelist 258 try:259 command = token.contents.split()[0]260 except IndexError:261 self.empty_block_tag(token)262 262 # execute callback function for this tag and append 263 263 # resulting node 264 264 self.enter_command(command, token) -
django/template/loader_tags.py
189 189 parser.__loaded_blocks.append(block_name) 190 190 except AttributeError: # parser.__loaded_blocks isn't a list yet 191 191 parser.__loaded_blocks = [block_name] 192 nodelist = parser.parse(('endblock', 'endblock %s' % block_name)) 193 parser.delete_first_token() 192 nodelist = parser.parse(('endblock',)) 193 194 # This check is kept for backwards-compatibility. See #3100. 195 endblock = parser.next_token() 196 acceptable_endblocks = ('endblock', 'endblock %s' % block_name) 197 if endblock.contents not in acceptable_endblocks: 198 parser.invalid_block_tag(endblock, 'endblock', acceptable_endblocks) 199 194 200 return BlockNode(block_name, nodelist) 195 201 196 202 @register.tag('extends')