[0.6.7] fix ODSResponse
This commit is contained in:
parent
058121d985
commit
d33c82e348
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
__version__ = '0.6.6'
|
__version__ = '0.6.7'
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
return f'HalfAPI version:{__version__}'
|
return f'HalfAPI version:{__version__}'
|
||||||
|
|
|
@ -26,6 +26,7 @@ import orjson
|
||||||
from starlette.responses import PlainTextResponse, Response, JSONResponse
|
from starlette.responses import PlainTextResponse, Response, JSONResponse
|
||||||
|
|
||||||
from .user import JWTUser, Nobody
|
from .user import JWTUser, Nobody
|
||||||
|
from ..logging import logger
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -129,8 +130,15 @@ class ODSResponse(Response):
|
||||||
return
|
return
|
||||||
|
|
||||||
with BytesIO() as ods_file:
|
with BytesIO() as ods_file:
|
||||||
# rows.insert(0, rownames)
|
rows = []
|
||||||
self.sheet = pe.Sheet(d_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(
|
self.sheet.save_to_memory(
|
||||||
file_type='ods',
|
file_type='ods',
|
||||||
stream=ods_file)
|
stream=ods_file)
|
||||||
|
|
Loading…
Reference in New Issue