[py3] Fixed file_storage tests.

This commit is contained in:
Aymeric Augustin 2012-08-18 10:24:23 +02:00
parent 6cb76cb140
commit 1ad05172cb
1 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
from io import BytesIO from io import BytesIO, UnsupportedOperation
from django.utils.encoding import smart_bytes, smart_text from django.utils.encoding import smart_bytes, smart_text
from django.core.files.utils import FileProxyMixin from django.core.files.utils import FileProxyMixin
@ -64,8 +64,10 @@ class File(FileProxyMixin):
if not chunk_size: if not chunk_size:
chunk_size = self.DEFAULT_CHUNK_SIZE chunk_size = self.DEFAULT_CHUNK_SIZE
if hasattr(self, 'seek'): try:
self.seek(0) self.seek(0)
except (AttributeError, UnsupportedOperation):
pass
while True: while True:
data = self.read(chunk_size) data = self.read(chunk_size)