summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
authorJeremy Dunck <jdunck@gmail.com>2007-06-25 19:33:37 +0000
committerJeremy Dunck <jdunck@gmail.com>2007-06-25 19:33:37 +0000
commitfc779fe55aec84994e7e761c743716ba03484bcc (patch)
treed139f5ce44133e630c7bb1b965baa3120ba23c99 /django/http
parentb0a56a9919d2304fa08b71373b53fdfb5ca72de9 (diff)
gis: Merged revisions 5491-5539 via svnmerge from
http://code.djangoproject.com/svn/django/trunk git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@5540 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/http')
-rw-r--r--django/http/__init__.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py
index a8c8afe433..ca3b5eab24 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -222,12 +222,6 @@ class HttpResponse(object):
content = ''.join(self._container)
if isinstance(content, unicode):
content = content.encode(self._charset)
-
- # If self._container was an iterator, we have just exhausted it, so we
- # need to save the results for anything else that needs access
- if not self._is_string:
- self._container = [content]
- self._is_string = True
return content
def _set_content(self, value):
@@ -237,10 +231,14 @@ class HttpResponse(object):
content = property(_get_content, _set_content)
def __iter__(self):
- for chunk in self._container:
- if isinstance(chunk, unicode):
- chunk = chunk.encode(self._charset)
- yield chunk
+ self._iterator = self._container.__iter__()
+ return self
+
+ def next(self):
+ chunk = self._iterator.next()
+ if isinstance(chunk, unicode):
+ chunk = chunk.encode(self._charset)
+ return chunk
def close(self):
if hasattr(self._container, 'close'):