Fix Excel download of ordering batch, per python3

This commit is contained in:
Lance Edgar 2019-01-21 17:11:12 -06:00
parent 5a96672d79
commit 318e8645b2
2 changed files with 7 additions and 10 deletions

View file

@ -36,8 +36,6 @@ from rattail.db import model, api
from rattail.core import Object
from rattail.time import localtime
from pyramid.response import FileResponse
from tailbone.views.purchasing import PurchasingBatchView
@ -354,10 +352,7 @@ class OrderingBatchView(PurchasingBatchView):
path = batch.filepath(self.rattail_config, filename)
workbook.save(path)
response = FileResponse(path, request=self.request)
response.content_length = os.path.getsize(path)
response.content_disposition = b'attachment; filename="{}"'.format(filename)
return response
return self.file_response(path)
@classmethod
def _ordering_defaults(cls, config):