File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 15
15
class ByteStreamManager (FileManager ):
16
16
def __init__ (self , buffer = None ):
17
17
if is_stream (buffer ):
18
- self ._zipfile_as_bytes = buffer
18
+ self ._zipfile_as_bytes = buffer . getvalue ()
19
19
else :
20
- self ._zipfile_as_bytes = StringIO ( buffer )
20
+ self ._zipfile_as_bytes = buffer
21
21
super (ByteStreamManager , self ).__init__ ()
22
22
23
23
def save (self , filename , backup = False ):
@@ -31,5 +31,4 @@ def has_zip(self):
31
31
return self ._zipfile_as_bytes is not None
32
32
33
33
def _open_bytestream (self ):
34
- self ._zipfile_as_bytes .seek (0 )
35
- return self ._zipfile_as_bytes
34
+ return StringIO (self ._zipfile_as_bytes )
Original file line number Diff line number Diff line change @@ -40,8 +40,9 @@ def is_stream(instance):
40
40
41
41
else : # PY2
42
42
# distiguish StringIO
43
- from StringIO import StringIO
43
+ from cStringIO import StringIO
44
44
from cStringIO import InputType , OutputType
45
+ from StringIO import SlowStringIO
45
46
46
47
tostr = unicode
47
48
def is_string (value ):
@@ -80,4 +81,4 @@ def is_zipfile(data):
80
81
def is_stream (instance ):
81
82
return (isinstance (instance , InputType ) or
82
83
isinstance (instance , OutputType ) or
83
- isinstance (instance , StringIO ))
84
+ isinstance (instance , SlowStringIO ))
You can’t perform that action at this time.
0 commit comments