1
0
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:
Chris Cahoon 2009-07-17 12:36:29 +00:00
parent 88b1183425
commit aeaa921a6d

View File

@ -288,6 +288,7 @@ class HttpResponse(object):
if not content_type:
content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE,
self._charset)
# Expects content to be an iterable container or a string.
self._container = [''.join(content)]
if hasattr(content, 'close'):
content.close()
@ -301,8 +302,8 @@ class HttpResponse(object):
def __str__(self):
"""Full HTTP message, including headers."""
headers = ['%s: %s' % (k, v) for k, v in self._headers.values()]
return '\n'.join(headers) + '\n\n' + self.content
return '\n'.join(['%s: %s' % (k, v) for k, v in self._headers.values()]) \
+ "\n\n" + self.content
def _convert_to_ascii(self, *values):
"""Converts all values to ascii strings."""
@ -414,7 +415,7 @@ class HttpResponse(object):
return str(chunk)
def close(self):
"No-op that remains for backwards compatibility. Ref #6527"
"No-op. Remains for backwards compatibility. Refs #6527"
pass
# The remaining methods partially implement the file-like object interface.