diff options
| author | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2007-06-22 16:56:04 +0000 |
|---|---|---|
| committer | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2007-06-22 16:56:04 +0000 |
| commit | 0cb8e31823b2e9f05c4ae868c19f5f38e78a5f2e (patch) | |
| tree | ac6cc6152cbb5fe1968dc399bc1716f29cd41165 /django/http/__init__.py | |
| parent | 829b25833a8e8ee6ce1fecdcd0733ededebe065b (diff) | |
boulder-oracle-sprint: Merged to [5511]archive/attic/boulder-oracle-sprint
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/http/__init__.py')
| -rw-r--r-- | django/http/__init__.py | 18 |
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'): |
