Django

Code

Ticket #6063: basehttp_safestring.patch

File basehttp_safestring.patch, 0.8 kB (added by Martin Conte, 2 years ago)

Safestring is also an string ;)

  • django/core/servers/basehttp.py

    old new  
    99 
    1010from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer 
    1111from types import ListType, StringType 
     12from django.utils.safestring import SafeString 
    1213import mimetypes 
    1314import os 
    1415import re 
     
    385386 
    386387    def write(self, data): 
    387388        """'write()' callable as specified by PEP 333""" 
     389        assert type(data) in (StringType, SafeString), \ 
     390            "write() argument must be string" 
    388391 
    389         assert type(data) is StringType,"write() argument must be string" 
    390  
    391392        if not self.status: 
    392393            raise AssertionError("write() before start_response()") 
    393394