Author: mtredinnick
Date: 2007-11-30 09:32:01 -0600 (Fri, 30 Nov 2007)
New Revision: 6778

Modified:
   django/trunk/django/template/__init__.py
   django/trunk/tests/regressiontests/templates/unicode.py
Log:
Fixed #6057 -- Mark rendered template output as safe for auto-escaping purposes.


Modified: django/trunk/django/template/__init__.py
===================================================================
--- django/trunk/django/template/__init__.py    2007-11-30 06:23:24 UTC (rev 
6777)
+++ django/trunk/django/template/__init__.py    2007-11-30 15:32:01 UTC (rev 
6778)
@@ -804,7 +804,7 @@
                 bits.append(self.render_node(node, context))
             else:
                 bits.append(node)
-        return ''.join([force_unicode(b) for b in bits])
+        return mark_safe(''.join([force_unicode(b) for b in bits]))
 
     def get_nodes_by_type(self, nodetype):
         "Return a list of all nodes of the given type"

Modified: django/trunk/tests/regressiontests/templates/unicode.py
===================================================================
--- django/trunk/tests/regressiontests/templates/unicode.py     2007-11-30 
06:23:24 UTC (rev 6777)
+++ django/trunk/tests/regressiontests/templates/unicode.py     2007-11-30 
15:32:01 UTC (rev 6778)
@@ -3,6 +3,7 @@
 unicode_tests = ur"""
 Templates can be created from unicode strings.
 >>> from django.template import *
+>>> from django.utils.safestring import SafeData
 >>> t1 = Template(u'ŠĐĆŽćžšđ {{ var }}')
 
 Templates can also be created from bytestrings. These are assumed by encoded
@@ -24,10 +25,13 @@
 >>> c4 = Context({u'var': '\xc4\x90\xc4\x91'})
 
 Since both templates and all four contexts represent the same thing, they all
-render the same (and are returned as unicode objects).
+render the same (and are returned as unicode objects and "safe" objects as
+well, for auto-escaping purposes).
 
 >>> t1.render(c3) == t2.render(c3)
 True
->>> type(t1.render(c3))
-<type 'unicode'>
+>>> isinstance(t1.render(c3), unicode)
+True
+>>> isinstance(t1.render(c3), SafeData)
+True
 """


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to