fix suffix processing

This commit is contained in:
Jean-Marie Place 2021-09-25 09:07:05 +02:00
parent 1741e75f72
commit 81df68b491
4 changed files with 3 additions and 4 deletions

View File

@ -272,7 +272,6 @@ def etudarchive_generate_excel_sample(group_id=None, REQUEST=None):
suffix=scu.XLSX_SUFFIX, suffix=scu.XLSX_SUFFIX,
mime=scu.XLSX_MIMETYPE, 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): def etudarchive_import_files_form(group_id, REQUEST=None):

View File

@ -786,7 +786,7 @@ def groups_table(
L = [dicttakestr(m, keys) for m in groups_infos.members] L = [dicttakestr(m, keys) for m in groups_infos.members]
title = "etudiants_%s" % groups_infos.groups_filename title = "etudiants_%s" % groups_infos.groups_filename
xls = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title) 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) return scu.send_file(xls, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
else: else:
raise ValueError("unsupported format") raise ValueError("unsupported format")

View File

@ -328,7 +328,7 @@ def feuille_preparation_jury(formsemestre_id, REQUEST):
xls = ws.generate() xls = ws.generate()
return scu.send_file( return scu.send_file(
xls, xls,
f"PrepaJury{sn}{scu.XLSX_SUFFIX}", f"PrepaJury{sn}",
scu.XLSX_SUFFIX, scu.XLSX_SUFFIX,
mime=scu.XLSX_MIMETYPE, mime=scu.XLSX_MIMETYPE,
) )

View File

@ -231,7 +231,7 @@ def do_formsemestre_recapcomplet(
return data return data
elif format == "csv": elif format == "csv":
return scu.send_file(data, filename=filename, mime=scu.CSV_MIMETYPE) 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) return scu.send_file(data, filename=filename, mime=scu.XLSX_MIMETYPE)
elif format == "json": elif format == "json":
js = json.dumps(data, indent=1, cls=scu.ScoDocJSONEncoder) js = json.dumps(data, indent=1, cls=scu.ScoDocJSONEncoder)