Ticket #6586: extend.3.patch
File extend.3.patch, 1.4 KB (added by , 17 years ago) |
---|
-
loader_tags.py
43 43 self.nodelist = nodelist 44 44 self.parent_name, self.parent_name_expr = parent_name, parent_name_expr 45 45 self.template_dirs = template_dirs 46 self.compiled_parent = None 46 47 47 48 def __repr__(self): 48 49 if self.parent_name_expr: … … 67 68 else: 68 69 return get_template_from_string(source, origin, parent) 69 70 70 def render(self, context):71 def process_parent( self, context ): 71 72 compiled_parent = self.get_parent(context) 72 73 pos = 0 73 74 while isinstance(compiled_parent.nodelist[pos], TextNode): … … 90 91 parent_block.parent = block_node.parent 91 92 parent_block.add_parent(parent_block.nodelist) 92 93 parent_block.nodelist = block_node.nodelist 94 return compiled_parent 95 96 def render(self, context): 97 if self.compiled_parent: 98 compiled_parent = self.compiled_parent 99 else: 100 compiled_parent = self.process_parent(context) 101 # cache it, if static 102 if self.parent_name: 103 self.compiled_parent = compiled_parent 104 93 105 return compiled_parent.render(context) 94 106 95 107 class ConstantIncludeNode(Node):