Django

Code

Show
Ignore:
Timestamp:
06/26/08 10:11:55 (7 months ago)
Author:
jbronn
Message:

gis: Merged revisions 7643-7662,7667-7668,7672-7682,7686-7693,7695-7698,7700-7702,7704-7706,7710,7712-7729,7731-7732,7738-7758,7760-7766 via svnmerge from trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis

    • Property svnmerge-integrated changed from /django/trunk:1-7641 to /django/trunk:1-7767
  • django/branches/gis/django/template/loader_tags.py

    r7103 r7768  
    7070    def render(self, context): 
    7171        compiled_parent = self.get_parent(context) 
    72         pos = 0 
    73         while isinstance(compiled_parent.nodelist[pos], TextNode): 
    74             pos += 1 
    75         parent_is_child = isinstance(compiled_parent.nodelist[pos], ExtendsNode) 
    7672        parent_blocks = dict([(n.name, n) for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)]) 
    7773        for block_node in self.nodelist.get_nodes_by_type(BlockNode): 
     
    8480                # add this BlockNode to the parent's ExtendsNode nodelist, so 
    8581                # it'll be checked when the parent node's render() is called. 
    86                 if parent_is_child: 
    87                     compiled_parent.nodelist[pos].nodelist.append(block_node) 
     82 
     83                # Find out if the parent template has a parent itself 
     84                for node in compiled_parent.nodelist: 
     85                    if not isinstance(node, TextNode): 
     86                        # If the first non-text node is an extends, handle it. 
     87                        if isinstance(node, ExtendsNode): 
     88                            node.nodelist.append(block_node) 
     89                        # Extends must be the first non-text node, so once you find 
     90                        # the first non-text node you can stop looking.  
     91                        break 
    8892            else: 
    8993                # Keep any existing parents and add a new one. Used by BlockNode.