Ticket #14765: little_tweak_of_tempate_rendering.patch
File little_tweak_of_tempate_rendering.patch, 1.7 KB (added by , 14 years ago) |
---|
-
django/template/base.py
1 from __builtin__ import classmethod 1 2 import imp 2 3 import re 3 4 from inspect import getargspec … … 737 738 # extend_nodelist(). 738 739 contains_nontext = False 739 740 741 @classmethod 742 def mark_safe_unicode(cls, bits): 743 return mark_safe(''.join([force_unicode(b) for b in bits])) 744 740 745 def render(self, context): 741 746 bits = [] 742 747 for node in self: … … 744 749 bits.append(self.render_node(node, context)) 745 750 else: 746 751 bits.append(node) 747 return mark_safe(''.join([force_unicode(b) for b in bits]))752 return NodeList.mark_safe_unicode(bits) 748 753 749 754 def get_nodes_by_type(self, nodetype): 750 755 "Return a list of all nodes of the given type" -
django/template/defaulttags.py
192 192 if len_values < 1: 193 193 context.pop() 194 194 return self.nodelist_empty.render(context) 195 nodelist = NodeList()195 nodelist = [] 196 196 if self.is_reversed: 197 197 values = reversed(values) 198 198 unpack = len(self.loopvars) > 1 … … 233 233 # context. 234 234 context.pop() 235 235 context.pop() 236 return nodelist.render(context)236 return NodeList.mark_safe_unicode(nodelist) 237 237 238 238 class IfChangedNode(Node): 239 239 child_nodelists = ('nodelist_true', 'nodelist_false')