Loading django/http/response.py +2 −2 Original line number Diff line number Diff line Loading @@ -260,9 +260,9 @@ class HttpResponse(HttpResponseBase): else: self._container = [value] self._base_content_is_iter = False self._iterator = iter(self._container) def __iter__(self): self._iterator = iter(self._container) return self def __next__(self): Loading @@ -284,7 +284,7 @@ class HttpResponse(HttpResponseBase): def tell(self): if self._base_content_is_iter: raise Exception("This %s instance cannot tell its position" % self.__class__.__name__) return len(self.content) return sum([len(chunk) for chunk in self]) class StreamingHttpResponse(HttpResponseBase): Loading tests/regressiontests/httpwrappers/tests.py +0 −7 Original line number Diff line number Diff line Loading @@ -330,13 +330,6 @@ class HttpResponseTests(unittest.TestCase): self.assertRaises(UnicodeEncodeError, getattr, r, 'content') def test_iterator_isnt_rewound(self): # Regression test for #13222 r = HttpResponse('abc') i = iter(r) self.assertEqual(list(i), [b'abc']) self.assertEqual(list(i), []) def test_file_interface(self): r = HttpResponse() r.write(b"hello") Loading Loading
django/http/response.py +2 −2 Original line number Diff line number Diff line Loading @@ -260,9 +260,9 @@ class HttpResponse(HttpResponseBase): else: self._container = [value] self._base_content_is_iter = False self._iterator = iter(self._container) def __iter__(self): self._iterator = iter(self._container) return self def __next__(self): Loading @@ -284,7 +284,7 @@ class HttpResponse(HttpResponseBase): def tell(self): if self._base_content_is_iter: raise Exception("This %s instance cannot tell its position" % self.__class__.__name__) return len(self.content) return sum([len(chunk) for chunk in self]) class StreamingHttpResponse(HttpResponseBase): Loading
tests/regressiontests/httpwrappers/tests.py +0 −7 Original line number Diff line number Diff line Loading @@ -330,13 +330,6 @@ class HttpResponseTests(unittest.TestCase): self.assertRaises(UnicodeEncodeError, getattr, r, 'content') def test_iterator_isnt_rewound(self): # Regression test for #13222 r = HttpResponse('abc') i = iter(r) self.assertEqual(list(i), [b'abc']) self.assertEqual(list(i), []) def test_file_interface(self): r = HttpResponse() r.write(b"hello") Loading