From aeaa921a6d3cbcf5564f5ff413518ba73c79ba10 Mon Sep 17 00:00:00 2001 From: Chris Cahoon Date: Fri, 17 Jul 2009 12:36:29 +0000 Subject: [PATCH] [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 --- django/http/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/http/__init__.py b/django/http/__init__.py index 4da8ce5d9e..2fe1247f65 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -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.