Skip to content

Commit aeaa921

Browse files
committed
[soc2009/http-wsgi-improvements] Add docs that I missed from the patch and reformat HttpResponse.__str__. refs django#6527
This and the previous revision on this branch appear to complete all the changes from django#6527. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/http-wsgi-improvements@11263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 88b1183 commit aeaa921

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

django/http/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ def __init__(self, content='', mimetype=None, status=None,
288288
if not content_type:
289289
content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE,
290290
self._charset)
291+
# Expects content to be an iterable container or a string.
291292
self._container = [''.join(content)]
292293
if hasattr(content, 'close'):
293294
content.close()
@@ -301,8 +302,8 @@ def __init__(self, content='', mimetype=None, status=None,
301302

302303
def __str__(self):
303304
"""Full HTTP message, including headers."""
304-
headers = ['%s: %s' % (k, v) for k, v in self._headers.values()]
305-
return '\n'.join(headers) + '\n\n' + self.content
305+
return '\n'.join(['%s: %s' % (k, v) for k, v in self._headers.values()]) \
306+
+ "\n\n" + self.content
306307

307308
def _convert_to_ascii(self, *values):
308309
"""Converts all values to ascii strings."""
@@ -414,7 +415,7 @@ def next(self):
414415
return str(chunk)
415416

416417
def close(self):
417-
"No-op that remains for backwards compatibility. Ref #6527"
418+
"No-op. Remains for backwards compatibility. Refs #6527"
418419
pass
419420

420421
# The remaining methods partially implement the file-like object interface.

0 commit comments

Comments
 (0)