Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

newforms-admin: Merged from trunk up to [6782].

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d0c49bfc60ce1f33f1bb1908482a0ee4e99d6525 1 parent fcb30a1
Joseph Kocherhans authored November 30, 2007
2  django/contrib/admin/templates/admin/includes/fieldset.html
@@ -10,7 +10,7 @@
10 10
           {% else %}
11 11
               {{ field.label_tag }}{{ field.field }}
12 12
           {% endif %}
13  
-          {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %}
  13
+          {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %}
14 14
       {% endfor %}
15 15
       </div>
16 16
   {% endfor %}
13  django/core/servers/basehttp.py
@@ -8,7 +8,6 @@
8 8
 """
9 9
 
10 10
 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
11  
-from types import ListType, StringType
12 11
 import mimetypes
13 12
 import os
14 13
 import re
@@ -72,7 +71,7 @@ def _formatparam(param, value=None, quote=1):
72 71
 class Headers(object):
73 72
     """Manage a collection of HTTP response headers"""
74 73
     def __init__(self,headers):
75  
-        if type(headers) is not ListType:
  74
+        if not isinstance(headers, list):
76 75
             raise TypeError("Headers must be a list of name/value tuples")
77 76
         self._headers = headers
78 77
 
@@ -327,7 +326,7 @@ def set_content_length(self):
327 326
         """Compute Content-Length or switch to chunked encoding if possible"""
328 327
         try:
329 328
             blocks = len(self.result)
330  
-        except (TypeError,AttributeError,NotImplementedError):
  329
+        except (TypeError, AttributeError, NotImplementedError):
331 330
             pass
332 331
         else:
333 332
             if blocks==1:
@@ -356,14 +355,14 @@ def start_response(self, status, headers,exc_info=None):
356 355
         elif self.headers is not None:
357 356
             raise AssertionError("Headers already set!")
358 357
 
359  
-        assert type(status) is StringType,"Status must be a string"
  358
+        assert isinstance(status, str),"Status must be a string"
360 359
         assert len(status)>=4,"Status must be at least 4 characters"
361 360
         assert int(status[:3]),"Status message must begin w/3-digit code"
362 361
         assert status[3]==" ", "Status message must have a space after code"
363 362
         if __debug__:
364 363
             for name,val in headers:
365  
-                assert type(name) is StringType,"Header names must be strings"
366  
-                assert type(val) is StringType,"Header values must be strings"
  364
+                assert isinstance(name, str),"Header names must be strings"
  365
+                assert isinstance(val, str),"Header values must be strings"
367 366
                 assert not is_hop_by_hop(name),"Hop-by-hop headers not allowed"
368 367
         self.status = status
369 368
         self.headers = self.headers_class(headers)
@@ -386,7 +385,7 @@ def send_preamble(self):
386 385
     def write(self, data):
387 386
         """'write()' callable as specified by PEP 333"""
388 387
 
389  
-        assert type(data) is StringType,"write() argument must be string"
  388
+        assert isinstance(data, str), "write() argument must be string"
390 389
 
391 390
         if not self.status:
392 391
             raise AssertionError("write() before start_response()")
2  django/template/__init__.py
@@ -804,7 +804,7 @@ def render(self, context):
804 804
                 bits.append(self.render_node(node, context))
805 805
             else:
806 806
                 bits.append(node)
807  
-        return ''.join([force_unicode(b) for b in bits])
  807
+        return mark_safe(''.join([force_unicode(b) for b in bits]))
808 808
 
809 809
     def get_nodes_by_type(self, nodetype):
810 810
         "Return a list of all nodes of the given type"
10  tests/regressiontests/templates/unicode.py
@@ -3,6 +3,7 @@
3 3
 unicode_tests = ur"""
4 4
 Templates can be created from unicode strings.
5 5
 >>> from django.template import *
  6
+>>> from django.utils.safestring import SafeData
6 7
 >>> t1 = Template(u'ŠĐĆŽćžšđ {{ var }}')
7 8
 
8 9
 Templates can also be created from bytestrings. These are assumed by encoded
@@ -24,10 +25,13 @@
24 25
 >>> c4 = Context({u'var': '\xc4\x90\xc4\x91'})
25 26
 
26 27
 Since both templates and all four contexts represent the same thing, they all
27  
-render the same (and are returned as unicode objects).
  28
+render the same (and are returned as unicode objects and "safe" objects as
  29
+well, for auto-escaping purposes).
28 30
 
29 31
 >>> t1.render(c3) == t2.render(c3)
30 32
 True
31  
->>> type(t1.render(c3))
32  
-<type 'unicode'>
  33
+>>> isinstance(t1.render(c3), unicode)
  34
+True
  35
+>>> isinstance(t1.render(c3), SafeData)
  36
+True
33 37
 """

0 notes on commit d0c49bf

Please sign in to comment.
Something went wrong with that request. Please try again.