Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
2 changed files with 5 additions and 10 deletions
Showing only changes of commit 91f4ee9999 - Show all commits

View File

@ -652,13 +652,13 @@ def _excel_to_list(filelike):
"""returns list of list""" """returns list of list"""
workbook = _open_workbook(filelike) workbook = _open_workbook(filelike)
diag = [] # liste de chaines pour former message d'erreur 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 !") diag.append("Aucune feuille trouvée dans le classeur !")
return diag, None return diag, None
# n'utilise que la première feuille: # 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 !") 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] ws = workbook[sheet_name]
diag_sheet, matrix = _excel_sheet_to_list(ws, sheet_name) diag_sheet, matrix = _excel_sheet_to_list(ws, sheet_name)
diag += diag_sheet diag += diag_sheet
@ -707,11 +707,11 @@ def _excel_workbook_to_list(filelike):
""" """
workbook = _open_workbook(filelike) workbook = _open_workbook(filelike)
diag = [] # liste de chaines pour former message d'erreur 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 !") diag.append("Aucune feuille trouvée dans le classeur !")
return diag, None return diag, None
matrix_list = [] matrix_list = []
for sheet_name in workbook.get_sheet_names(): for sheet_name in workbook.sheetnames:
# fill matrix # fill matrix
sheet = workbook.get_sheet_by_name(sheet_name) sheet = workbook.get_sheet_by_name(sheet_name)
diag_sheet, matrix = _excel_sheet_to_list(sheet, 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.telephone == "102030405"
assert adresse.telephonemobile == "605040302" assert adresse.telephonemobile == "605040302"
# #
# mapp.set_sco_dept("TEST_")
# ctx.push()
# login_user(User.query.filter_by(user_name="admin").first())