summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 06:50:16 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 06:50:16 +0000
commit570e8936d9aaf217ef61d9b46fb9f5361f013c28 (patch)
tree9c1120c489e323e0211fa59056214f42652be651
parentaa320700d2d94612e8a1fd4cc42fc74dbce6c58b (diff)
Fixed #4969 -- Changed content retrieval in HttpResponse to be more robust in
the presence of an existing content encoding. Fixes some sporadic failures with the GzipMiddleware, for example. Thanks, Johann Queuniet. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/http/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py
index 6fe6d0d760..6d13973097 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -317,8 +317,9 @@ class HttpResponse(object):
self.cookies[key]['max-age'] = 0
def _get_content(self):
- content = smart_str(''.join(self._container), self._charset)
- return content
+ if self.has_header('Content-Encoding'):
+ return ''.join(self._container)
+ return smart_str(''.join(self._container), self._charset)
def _set_content(self, value):
self._container = [value]