Ticket #3526: content_type.diff
File content_type.diff, 1.3 KB (added by , 18 years ago) |
---|
-
django/http/__init__.py
155 155 156 156 class HttpResponse(object): 157 157 "A basic HTTP response, with content and dictionary-accessed headers" 158 def __init__(self, content='', mimetype=None):158 def __init__(self, content='', content_type=None, mimetype=None): 159 159 from django.conf import settings 160 160 self._charset = settings.DEFAULT_CHARSET 161 if not mimetype: 162 mimetype = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE, settings.DEFAULT_CHARSET) 161 if mimetype: 162 content_type = mimetype # For backwards compatibility 163 if not content_type: 164 content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE, settings.DEFAULT_CHARSET) 163 165 if not isinstance(content, basestring) and hasattr(content, '__iter__'): 164 166 self._container = content 165 167 self._is_string = False 166 168 else: 167 169 self._container = [content] 168 170 self._is_string = True 169 self.headers = {'Content-Type': mimetype}171 self.headers = {'Content-Type': content_type} 170 172 self.cookies = SimpleCookie() 171 173 self.status_code = 200 172 174