diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-08-18 10:24:23 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-08-18 10:24:23 +0200 |
| commit | 1ad05172cb5e2fafe85540e2525114843c693955 (patch) | |
| tree | ea0c42320f10dbaa2175c0352586ef6d6947d6be | |
| parent | 6cb76cb140d8ca9815fc90829b6636eb6e43ac42 (diff) | |
[py3] Fixed file_storage tests.
| -rw-r--r-- | django/core/files/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/core/files/base.py b/django/core/files/base.py index d7a8cb8539..4a422be90d 100644 --- a/django/core/files/base.py +++ b/django/core/files/base.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import os -from io import BytesIO +from io import BytesIO, UnsupportedOperation from django.utils.encoding import smart_bytes, smart_text from django.core.files.utils import FileProxyMixin @@ -64,8 +64,10 @@ class File(FileProxyMixin): if not chunk_size: chunk_size = self.DEFAULT_CHUNK_SIZE - if hasattr(self, 'seek'): + try: self.seek(0) + except (AttributeError, UnsupportedOperation): + pass while True: data = self.read(chunk_size) |
