From 13012d6a979e7cc86bf44048dcaa13bcdd48b72c Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sat, 10 Sep 2022 18:26:46 +0200 Subject: [PATCH] Warn instead of exception --- advlabdb/database_import.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/advlabdb/database_import.py b/advlabdb/database_import.py index 55237a3..eb82b0d 100644 --- a/advlabdb/database_import.py +++ b/advlabdb/database_import.py @@ -201,16 +201,19 @@ def importFromFile(filePath: Path): else: # Check if columns that should not change match if dbStudent.first_name != first_name: - raise DataBaseImportException( - f"First name {dbStudent.first_name} in the database does not match with the first name {first_name} provided in the import file for the student number {student_number}. In case the name is changed, please change it manually using the web interface first." + flash( + f'First name "{dbStudent.first_name}" in the database does not match with the first name "{first_name}" provided in the import file for the student number {student_number}.', + "warning", ) if dbStudent.last_name != last_name: - raise DataBaseImportException( - f"Last name {dbStudent.last_name} in the database does not match with the last name {last_name} provided in the import file for the student number {student_number}. In case the name is changed, please change it manually using the web interface first." + flash( + f'Last name "{dbStudent.last_name}" in the database does not match with the last name "{last_name}" provided in the import file for the student number {student_number}.', + "warning", ) if dbStudent.uni_email != uni_email: - raise DataBaseImportException( - f"University email {dbStudent.uni_email} in the database does not match with the university email {last_name} provided in the import file for the student number {student_number}. In case the email is changed, please change it manually using the web interface first." + flash( + f'University email "{dbStudent.uni_email}" in the database does not match with the university email "{last_name}" provided in the import file for the student number {student_number}.', + "warning", ) dbStudent.contact_email = contact_email