From 1ad05172cb5e2fafe85540e2525114843c693955 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 18 Aug 2012 10:24:23 +0200 Subject: [PATCH] [py3] Fixed file_storage tests. --- django/core/files/base.py | 6 ++++-- 1 file 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)