fix 500 errors with excel files > 500k size limit

werkzeug's internal workings keep files under 500kb in memory, and files
greater than 500kb as a TemporaryFile

(https://github.com/pallets/werkzeug/blob/0.11-maintenance/werkzeug/formparser.py#L38)

when we encounter a CSV or TSV, we call normalise_newlines, which invokes
`.read()`, however when we were passing straight into pyexcel, we called
`file.getvalue()` - this exists on BytesIO (small files) but not on
TemporaryFile objects (large files) - we were seeing 500 errors
This commit is contained in:
Leo Hemsted
2016-10-26 15:44:24 +01:00
parent a93333572f
commit 26a985720c
3 changed files with 12 additions and 7 deletions

View File

@@ -8,7 +8,6 @@ from bs4 import BeautifulSoup
from functools import partial
from flask import url_for
from tests import validate_route_permission
from datetime import datetime
template_types = ['email', 'sms']