Ticket #6646: 6646.diff
File 6646.diff, 3.0 KB (added by , 16 years ago) |
---|
-
django/template/loader_tags.py
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py index 38b2fff..3239abd 100644
a b class ExtendsNode(Node): 87 87 if isinstance(node, ExtendsNode): 88 88 node.nodelist.append(block_node) 89 89 # Extends must be the first non-text node, so once you find 90 # the first non-text node you can stop looking. 90 # the first non-text node you can stop looking. 91 91 break 92 92 else: 93 93 # Keep any existing parents and add a new one. Used by BlockNode. … … class ConstantIncludeNode(Node): 106 106 raise 107 107 self.template = None 108 108 109 @property 110 def nodelist(self): 111 if not self.template: 112 return None 113 return self.template.nodelist 114 109 115 def render(self, context): 110 116 if self.template: 111 117 return self.template.render(context) -
tests/regressiontests/templates/tests.py
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index c69e7cd..933f7e8 100644
a b class Templates(unittest.TestCase): 372 372 373 373 # Numbers as filter arguments should work 374 374 'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."), 375 375 376 376 #filters should accept empty string constants 377 377 'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""), 378 378 … … class Templates(unittest.TestCase): 732 732 # Inheritance from a template that doesn't have any blocks 733 733 'inheritance27': ("{% extends 'inheritance26' %}", {}, 'no tags'), 734 734 735 # Setup a template to be included by base template 736 'inheritance28': ("{% block included %}2{% endblock %}", {}, '2'), 737 738 # Setup a base template with an include 739 'inheritance29': ("1{% include 'inheritance28' %}3", {}, '123'), 740 741 # Inheritance with overriding a block included by the parent 742 'inheritance30': ("{% extends 'inheritance29' %}{% block included %}&{% endblock %}", {}, '1&3'), 743 744 # Setup a template to be included by child template 745 'inheritance31': ("{% block included %}_{% endblock %}", {}, '_'), 746 747 # Inheritance with overriding a block through an include 748 'inheritance32': ("{% extends 'inheritance28' %}{% include 'inheritance31' %}", {}, '_'), 749 750 # Inheritance with overriding a block included by the parent through an include in the child template (combine 30+32) 751 'inheritance33': ("{% extends 'inheritance29' %}{% include 'inheritance31' %}", {}, '1_3'), 752 735 753 ### I18N ################################################################## 736 754 737 755 # {% spaceless %} tag