Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_response_from_records returns None #23

Closed
hieu-n opened this issue Jul 20, 2017 · 1 comment
Closed

make_response_from_records returns None #23

hieu-n opened this issue Jul 20, 2017 · 1 comment

Comments

@hieu-n
Copy link

hieu-n commented Jul 20, 2017

Package version:

Python 3.6.1
Flask (0.12.2)
Flask-Excel (0.0.6)
pyexcel (0.5.1.1)
pyexcel-io (0.4.2)
pyexcel-ods (0.4.0)
pyexcel-webio (0.1.2)
pyexcel-xls (0.4.0)

In my code:

return make_response_from_records(records, file_type='xls', file_name=fn)

This raises an exception:

  File "/miniconda/envs/flecom/lib/python3.6/site-packages/flask/app.py", line 1725, in make_response
    raise ValueError('View function did not return a response')
ValueError: View function did not return a response

I stepped into make_response_from_records(...) and found this code which returns None:

# python3.6/site-packages/pyexcel_webio/__init__.py

def dummy_func(content, content_type=None, status=200, file_name=None):
    return None


__excel_response_func__ = dummy_func


def _make_response(content, file_type,
                   status=200, file_name=None):
    if hasattr(content, "read"):
        content = content.read()
    if file_name:
        if not file_name.endswith(file_type):
            file_name = "%s.%s" % (file_name, file_type)
    return __excel_response_func__(
        content,
        content_type=FILE_TYPE_MIME_TABLE[file_type],
        status=status, file_name=file_name)
@chfw
Copy link
Member

chfw commented Jul 20, 2017

please take v0.0.7 and please call init_excel(app) before you do anything else.

http://flask-excel.readthedocs.io/en/latest/#setup

web v0.1.2 is to work with FE 0.0.7 which was slightly delayed to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants