[0.6.7] fix ODSResponse

This commit is contained in:
Maxime Alves LIRMM 2022-02-10 10:30:19 +01:00
parent 058121d985
commit d33c82e348
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
__version__ = '0.6.6'
__version__ = '0.6.7'
def version():
return f'HalfAPI version:{__version__}'

View File

@ -26,6 +26,7 @@ import orjson
from starlette.responses import PlainTextResponse, Response, JSONResponse
from .user import JWTUser, Nobody
from ..logging import logger
__all__ = [
@ -129,8 +130,15 @@ class ODSResponse(Response):
return
with BytesIO() as ods_file:
# rows.insert(0, rownames)
self.sheet = pe.Sheet(d_rows)
rows = []
if len(d_rows):
rows_names = list(d_rows[0].keys())
for elt in d_rows:
rows.append(list(elt.values()))
rows.insert(rows_names)
self.sheet = pe.Sheet(rows)
self.sheet.save_to_memory(
file_type='ods',
stream=ods_file)