summaryrefslogtreecommitdiff
path: root/django/template/__init__.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-02 07:42:51 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-02 07:42:51 +0000
commitf034c79cbc4f1a235e53d4ec666885ab8e9af8d9 (patch)
tree9d64966c0af403b76d796965afa00b2727e924a1 /django/template/__init__.py
parentecb56cecbddffe7f06e94a08d2d71713d85514e4 (diff)
Fixed #6510 -- Refactored the way child nodes are found in template nodes to avoid potential inconsistencies. Thanks to SmileyChris for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/template/__init__.py')
-rw-r--r--django/template/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py
index 7fb01f05b6..33ea0aa60f 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -770,6 +770,7 @@ class Node(object):
# Set this to True for nodes that must be first in the template (although
# they can be preceded by text nodes.
must_be_first = False
+ child_nodelists = ('nodelist',)
def render(self, context):
"Return the node rendered as a string"
@@ -783,8 +784,10 @@ class Node(object):
nodes = []
if isinstance(self, nodetype):
nodes.append(self)
- if hasattr(self, 'nodelist'):
- nodes.extend(self.nodelist.get_nodes_by_type(nodetype))
+ for attr in self.child_nodelists:
+ nodelist = getattr(self, attr, None)
+ if nodelist:
+ nodes.extend(nodelist.get_nodes_by_type(nodetype))
return nodes
class NodeList(list):