mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
[soc2009/http-wsgi-improvements] Add docs that I missed from the patch and reformat HttpResponse.__str__. refs #6527
This and the previous revision on this branch appear to complete all the changes from #6527. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/http-wsgi-improvements@11263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
88b1183425
commit
aeaa921a6d
@ -288,6 +288,7 @@ class HttpResponse(object):
|
|||||||
if not content_type:
|
if not content_type:
|
||||||
content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE,
|
content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE,
|
||||||
self._charset)
|
self._charset)
|
||||||
|
# Expects content to be an iterable container or a string.
|
||||||
self._container = [''.join(content)]
|
self._container = [''.join(content)]
|
||||||
if hasattr(content, 'close'):
|
if hasattr(content, 'close'):
|
||||||
content.close()
|
content.close()
|
||||||
@ -301,8 +302,8 @@ class HttpResponse(object):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Full HTTP message, including headers."""
|
"""Full HTTP message, including headers."""
|
||||||
headers = ['%s: %s' % (k, v) for k, v in self._headers.values()]
|
return '\n'.join(['%s: %s' % (k, v) for k, v in self._headers.values()]) \
|
||||||
return '\n'.join(headers) + '\n\n' + self.content
|
+ "\n\n" + self.content
|
||||||
|
|
||||||
def _convert_to_ascii(self, *values):
|
def _convert_to_ascii(self, *values):
|
||||||
"""Converts all values to ascii strings."""
|
"""Converts all values to ascii strings."""
|
||||||
@ -414,7 +415,7 @@ class HttpResponse(object):
|
|||||||
return str(chunk)
|
return str(chunk)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"No-op that remains for backwards compatibility. Ref #6527"
|
"No-op. Remains for backwards compatibility. Refs #6527"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# The remaining methods partially implement the file-like object interface.
|
# The remaining methods partially implement the file-like object interface.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user