Ticket #6586: extend.patch

File extend.patch, 1.1 KB (added by fredd4@…, 17 years ago)

patch for extends file

  • loader_tags.py

     
    4141        self.nodelist = nodelist
    4242        self.parent_name, self.parent_name_expr = parent_name, parent_name_expr
    4343        self.template_dirs = template_dirs
     44        if parent_name:
     45            self.compiled_parent = self.get_parent(None)
     46        else:
     47            self.compiled_parent = None
    4448
    4549    def get_parent(self, context):
    4650        if self.parent_name_expr:
     
    6165            return get_template_from_string(source, origin, parent)
    6266
    6367    def render(self, context):
    64         compiled_parent = self.get_parent(context)
     68        if self.compiled_parent:
     69            compiled_parent = self.compiled_parent
     70        else:
     71            compiled_parent = self.get_parent(context)
    6572        parent_is_child = isinstance(compiled_parent.nodelist[0], ExtendsNode)
    6673        parent_blocks = dict([(n.name, n) for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)])
    6774        for block_node in self.nodelist.get_nodes_by_type(BlockNode):
Back to Top