diff --git a/django/http/__init__.py b/django/http/__init__.py
index 51e6ca2..8f97428 100644
a
|
b
|
class HttpResponse(object):
|
694 | 694 | def tell(self): |
695 | 695 | if self._base_content_is_iter: |
696 | 696 | raise Exception("This %s instance cannot tell its position" % self.__class__) |
697 | | return sum([len(str(chunk)) for chunk in self._container]) |
| 697 | return sum([len(chunk) for chunk in self]) |
698 | 698 | |
699 | 699 | class HttpResponseRedirect(HttpResponse): |
700 | 700 | status_code = 302 |
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py
index 870324b..d52adc4 100644
a
|
b
|
|
| 1 | # -*- encoding: utf-8 -*- |
1 | 2 | from __future__ import unicode_literals |
2 | 3 | |
3 | 4 | import copy |
… |
… |
class HttpResponseTests(unittest.TestCase):
|
298 | 299 | self.assertRaises(UnicodeEncodeError, |
299 | 300 | getattr, r, 'content') |
300 | 301 | |
| 302 | def test_file_interface(self): |
| 303 | r = HttpResponse() |
| 304 | r.write(b"hello") |
| 305 | self.assertEqual(r.tell(), 5) |
| 306 | r.write("привет") |
| 307 | self.assertEqual(r.tell(), 17) |
| 308 | |
| 309 | r = HttpResponse(['abc']) |
| 310 | self.assertRaises(Exception, r.write, 'def') |
| 311 | |
| 312 | |
301 | 313 | class CookieTests(unittest.TestCase): |
302 | 314 | def test_encode(self): |
303 | 315 | """ |