Django

Code

Ticket #6063: httpresponse_only_str.diff

File httpresponse_only_str.diff, 0.7 kB (added by zgoda, 2 years ago)

Naive patch on HttpResponse to convert content to str (just to visualize the idea)

  • django/http/__init__.py

    old new  
    260260            self._container = content 
    261261            self._is_string = False 
    262262        else: 
    263             self._container = [content
     263            self._container = [str(content)
    264264            self._is_string = True 
    265265        self.cookies = SimpleCookie() 
    266266        if status: 
     
    318318        return smart_str(''.join(self._container), self._charset) 
    319319 
    320320    def _set_content(self, value): 
    321         self._container = [value
     321        self._container = [str(value)
    322322        self._is_string = True 
    323323 
    324324    content = property(_get_content, _set_content)