This commit is contained in:
Emmanuel Viennet 2021-09-21 16:51:07 +02:00
commit 13f1539282
2 changed files with 17 additions and 4 deletions

View File

@ -74,7 +74,8 @@ class ZRequest(object):
if k.endswith(":list"): if k.endswith(":list"):
self.form[k[:-5]] = request.args.getlist(k) self.form[k[:-5]] = request.args.getlist(k)
else: else:
self.form[k] = request.args[k] values = request.args.getlist(k)
self.form[k] = values[0] if len(values) == 1 else values
# current_app.logger.info("ZRequest.form=%s" % str(self.form)) # current_app.logger.info("ZRequest.form=%s" % str(self.form))
self.RESPONSE = ZResponse() self.RESPONSE = ZResponse()

View File

@ -563,12 +563,24 @@ def excel_feuille_saisie(e, titreannee, description, lines):
def excel_bytes_to_list(bytes_content): def excel_bytes_to_list(bytes_content):
filelike = io.BytesIO(bytes_content) try:
return _excel_to_list(filelike) filelike = io.BytesIO(bytes_content)
return _excel_to_list(filelike)
except:
raise ScoValueError("""
scolars_import_excel_file: un contenu xlsx semble corrompu!
peut-être avez vous fourni un fichier au mauvais format (txt, xls, ..)
""")
def excel_file_to_list(filename): def excel_file_to_list(filename):
return _excel_to_list(filename) try:
return _excel_to_list(filename)
except:
raise ScoValueError("""
scolars_import_excel_file: un contenu xlsx semble corrompu!
peut-être avez vous fourni un fichier au mauvais format (txt, xls, ..)
""")
def _excel_to_list(filelike): # we may need 'encoding' argument ? def _excel_to_list(filelike): # we may need 'encoding' argument ?