Skip to content

Commit 02b59b2

Browse files
committed
fix broken build
1 parent 1c922d0 commit 02b59b2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pyexcel_webio/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ def dummy_func(content, content_type=None, status=200, file_name=None):
218218
ExcelResponse = dummy_func
219219

220220

221-
def _make_response(io_stream, file_type,
221+
def _make_response(content, file_type,
222222
status=200, file_name=None):
223+
if hasattr(content, "read"):
224+
content = content.read()
223225
if file_name:
224226
if not file_name.endswith(file_type):
225227
file_name = "%s.%s" % (file_name, file_type)
226-
return ExcelResponse(io_stream.read(),
228+
return ExcelResponse(content,
227229
content_type=FILE_TYPE_MIME_TABLE[file_type],
228230
status=status, file_name=file_name)
229231

@@ -249,8 +251,8 @@ def make_response(pyexcel_instance, file_type,
249251
:param status: unless a different status is to be returned.
250252
:returns: http response
251253
"""
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)
254256

255257

256258
def make_response_from_array(array, file_type,

0 commit comments

Comments
 (0)