Ticket #6586: extend.2.patch
File extend.2.patch, 1.4 KB (added by , 17 years ago) |
---|
-
loader_tags.py
44 44 self.parent_name, self.parent_name_expr = parent_name, parent_name_expr 45 45 self.template_dirs = template_dirs 46 46 47 if parent_name: 48 self.compiled_parent = self.process_parent(None) 49 else: 50 self.compiled_parent = Non 51 47 52 def __repr__(self): 48 53 if self.parent_name_expr: 49 54 return "<ExtendsNode: extends %s>" % self.parent_name_expr.token … … 67 72 else: 68 73 return get_template_from_string(source, origin, parent) 69 74 70 def render(self, context):75 def process_parent( self, context ): 71 76 compiled_parent = self.get_parent(context) 72 77 pos = 0 73 78 while isinstance(compiled_parent.nodelist[pos], TextNode): … … 90 95 parent_block.parent = block_node.parent 91 96 parent_block.add_parent(parent_block.nodelist) 92 97 parent_block.nodelist = block_node.nodelist 98 return compiled_parent 99 100 def render(self, context): 101 if self.compiled_parent: 102 compiled_parent = self.compiled_parent 103 else: 104 compiled_parent = process_parent( self, context ) 93 105 return compiled_parent.render(context) 94 106 95 107 class ConstantIncludeNode(Node):