@@ -218,12 +218,14 @@ def dummy_func(content, content_type=None, status=200, file_name=None):
218
218
ExcelResponse = dummy_func
219
219
220
220
221
- def _make_response (io_stream , file_type ,
221
+ def _make_response (content , file_type ,
222
222
status = 200 , file_name = None ):
223
+ if hasattr (content , "read" ):
224
+ content = content .read ()
223
225
if file_name :
224
226
if not file_name .endswith (file_type ):
225
227
file_name = "%s.%s" % (file_name , file_type )
226
- return ExcelResponse (io_stream . read () ,
228
+ return ExcelResponse (content ,
227
229
content_type = FILE_TYPE_MIME_TABLE [file_type ],
228
230
status = status , file_name = file_name )
229
231
@@ -249,8 +251,8 @@ def make_response(pyexcel_instance, file_type,
249
251
:param status: unless a different status is to be returned.
250
252
:returns: http response
251
253
"""
252
- file_stream = pyexcel_instance .save_to_memory (file_type , None , ** keywords )
253
- return _make_response (file_stream , file_type , status , file_name )
254
+ file_content = pyexcel_instance .save_to_memory (file_type , None , ** keywords )
255
+ return _make_response (file_content , file_type , status , file_name )
254
256
255
257
256
258
def make_response_from_array (array , file_type ,
0 commit comments