1
0
forked from ScoDoc/ScoDoc

sco_excel: remove call to deprecated get_sheet_names

This commit is contained in:
Emmanuel Viennet 2023-10-17 22:17:44 +02:00
parent e87bb9a8db
commit 91f4ee9999
2 changed files with 5 additions and 10 deletions

View File

@ -652,13 +652,13 @@ def _excel_to_list(filelike):
"""returns list of list"""
workbook = _open_workbook(filelike)
diag = [] # liste de chaines pour former message d'erreur
if len(workbook.get_sheet_names()) < 1:
if len(workbook.sheetnames) < 1:
diag.append("Aucune feuille trouvée dans le classeur !")
return diag, None
# n'utilise que la première feuille:
if len(workbook.get_sheet_names()) > 1:
if len(workbook.sheetnames) > 1:
diag.append("Attention: n'utilise que la première feuille du classeur !")
sheet_name = workbook.get_sheet_names()[0]
sheet_name = workbook.sheetnames[0]
ws = workbook[sheet_name]
diag_sheet, matrix = _excel_sheet_to_list(ws, sheet_name)
diag += diag_sheet
@ -707,11 +707,11 @@ def _excel_workbook_to_list(filelike):
"""
workbook = _open_workbook(filelike)
diag = [] # liste de chaines pour former message d'erreur
if len(workbook.get_sheet_names()) < 1:
if len(workbook.sheetnames) < 1:
diag.append("Aucune feuille trouvée dans le classeur !")
return diag, None
matrix_list = []
for sheet_name in workbook.get_sheet_names():
for sheet_name in workbook.sheetnames:
# fill matrix
sheet = workbook.get_sheet_by_name(sheet_name)
diag_sheet, matrix = _excel_sheet_to_list(sheet, sheet_name)

View File

@ -180,8 +180,3 @@ def test_import_etuds_xlsx(test_client):
assert adresse.telephone == "102030405"
assert adresse.telephonemobile == "605040302"
#
# mapp.set_sco_dept("TEST_")
# ctx.push()
# login_user(User.query.filter_by(user_name="admin").first())