From 81df68b4912a321c43ea91aed873fde383e24cf5 Mon Sep 17 00:00:00 2001 From: Place Jean-Marie Date: Sat, 25 Sep 2021 09:07:05 +0200 Subject: [PATCH] fix suffix processing --- app/scodoc/sco_archives_etud.py | 1 - app/scodoc/sco_groups_view.py | 2 +- app/scodoc/sco_prepajury.py | 2 +- app/scodoc/sco_recapcomplet.py | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py index 0ea44268..f9a70f2d 100644 --- a/app/scodoc/sco_archives_etud.py +++ b/app/scodoc/sco_archives_etud.py @@ -272,7 +272,6 @@ def etudarchive_generate_excel_sample(group_id=None, REQUEST=None): suffix=scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE, ) - # return sco_excel.send_excel_file(REQUEST, data, "ImportFichiersEtudiants" + scu.XLSX_SUFFIX) def etudarchive_import_files_form(group_id, REQUEST=None): diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index f4a4d9eb..ebab7ec6 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -786,7 +786,7 @@ def groups_table( L = [dicttakestr(m, keys) for m in groups_infos.members] title = "etudiants_%s" % groups_infos.groups_filename xls = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title) - filename = title + scu.XLSX_SUFFIX + filename = title return scu.send_file(xls, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE) else: raise ValueError("unsupported format") diff --git a/app/scodoc/sco_prepajury.py b/app/scodoc/sco_prepajury.py index 4cee9409..084e311c 100644 --- a/app/scodoc/sco_prepajury.py +++ b/app/scodoc/sco_prepajury.py @@ -328,7 +328,7 @@ def feuille_preparation_jury(formsemestre_id, REQUEST): xls = ws.generate() return scu.send_file( xls, - f"PrepaJury{sn}{scu.XLSX_SUFFIX}", + f"PrepaJury{sn}", scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE, ) diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 9780821e..b788702f 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -231,7 +231,7 @@ def do_formsemestre_recapcomplet( return data elif format == "csv": return scu.send_file(data, filename=filename, mime=scu.CSV_MIMETYPE) - elif format[:3] == "xls" or format[:3] == "xlsx": + elif format[:3] == "xls" or format[:4] == "xlsx": return scu.send_file(data, filename=filename, mime=scu.XLSX_MIMETYPE) elif format == "json": js = json.dumps(data, indent=1, cls=scu.ScoDocJSONEncoder)