Ticket #6646: 6646.2.diff
File 6646.2.diff, 3.0 KB (added by , 15 years ago) |
---|
-
django/template/loader_tags.py
### Eclipse Workspace Patch 1.0 #P Django trunk
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. … … 106 106 raise 107 107 self.template = None 108 108 109 def _get_template(self): 110 return self._template 111 112 def _set_template(self, template): 113 """ 114 Set the node's ``template`` attribute, and also update the node's 115 ``nodelist`` attribute (used by ``Node.get_nodes_by_type()``). 116 """ 117 self._template = template 118 if template: 119 self.nodelist = self.template.nodelist 120 elif hasattr(self, 'nodelist'): 121 del self.nodelist 122 123 template = property(_get_template, _set_template) 124 109 125 def render(self, context): 110 126 if self.template: 111 127 return self.template.render(context) -
tests/regressiontests/templates/tests.py
802 802 # Inheritance from a template with a space in its name should work. 803 803 'inheritance29': ("{% extends 'inheritance 28' %}", {}, '!'), 804 804 805 # Setup a template to be included by base template 806 'inheritance30': ("{% block included %}2{% endblock %}", {}, '2'), 807 808 # Setup a base template with an include 809 'inheritance31': ("1{% include 'inheritance30' %}3", {}, '123'), 810 811 # Inheritance with overriding a block included by the parent 812 'inheritance32': ("{% extends 'inheritance31' %}{% block included %}&{% endblock %}", {}, '1&3'), 813 814 # Setup a template to be included by child template 815 'inheritance33': ("{% block included %}_{% endblock %}", {}, '_'), 816 817 # Inheritance with overriding a block through an include 818 'inheritance34': ("{% extends 'inheritance30' %}{% include 'inheritance33' %}", {}, '_'), 819 820 # Inheritance with overriding a block included by the parent through an include in the child template (combine 32+34) 821 'inheritance35': ("{% extends 'inheritance31' %}{% include 'inheritance33' %}", {}, '1_3'), 822 805 823 ### I18N ################################################################## 806 824 807 825 # {% spaceless %} tag