From e1c69a53d4c7f05cf4d1f7794171da039e31e3c7 Mon Sep 17 00:00:00 2001 From: Cherif Date: Sat, 7 Jun 2025 21:40:12 +0200 Subject: [PATCH] 07/06/2025 - 21h30 Signed-off-by: Cherif --- .idea/workspace.xml | 146 +++------------ GlobalVariable.py | 2 +- Inscription_mgt.py | 2 +- Log/log_file.log | 352 ++++++++++++++++++++++++++++++++++++ attached_file_mgt.py | 4 +- email_mgt.py | 21 ++- main.py | 25 ++- partner_order.py | 4 +- prj_common.py | 413 +++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 819 insertions(+), 150 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a9d715c..8377d38 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,122 +4,16 @@ - @@ -628,6 +521,7 @@ - \ No newline at end of file diff --git a/GlobalVariable.py b/GlobalVariable.py index 2145f08..14d28b9 100644 --- a/GlobalVariable.py +++ b/GlobalVariable.py @@ -843,7 +843,7 @@ les 'related_collection' sont : ['inscription', 'apprenant', 'contact', 'nointer """ EMAIL_DEST_RELATED_COLLECTION = ['inscription', 'apprenant', 'contact', 'nointernalcontact'] -EMAIL_MAX_DESTINAIRE = 30 +EMAIL_MAX_DESTINAIRE = 50 EMAIL_MAX_CC = 10 EMAIL_MAX_BCC = 10 EMAIL_MAX_PJ = 5 diff --git a/Inscription_mgt.py b/Inscription_mgt.py index 41b343b..3ce0af7 100644 --- a/Inscription_mgt.py +++ b/Inscription_mgt.py @@ -88,7 +88,7 @@ def AddStagiairetoClass(diction): if val not in field_list and val.startswith('my_') is False: mycommon.myprint(str(inspect.stack()[0][ 3]) + " - Le champ '" + val + "' n'est pas autorisé") - return False, "Impossible de créer le stagiaire. Toutes les informations fournies ne sont pas valables" + return False, "Toutes les informations fournies ne sont pas valables" """ Verification de la liste des champs obligatoires diff --git a/Log/log_file.log b/Log/log_file.log index e69de29..2db32f6 100644 --- a/Log/log_file.log +++ b/Log/log_file.log @@ -0,0 +1,352 @@ +INFO:root:2025-06-07 21:27:22.509179 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:27:22.509179 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:27:22.509179 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:27:22.509179 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:27:22.509179 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2025-06-07 21:27:28.477206 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:27:28.477206 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:27:28.477206 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:27:28.477206 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:27:28.477206 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 479-264-725 +INFO:root:2025-06-07 21:27:47.717076 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:27:49.709979 : send_invidual_email_for_ENT_Document_Notif -{'c': (421, b'4.7.0 Too many protocol errors (6) on this connection, closing transmission channel.'), 'o': (501, b'5.1.3 Invalid address'), 'n': (501, b'5.1.3 Invalid address'), 't': (501, b'5.1.3 Invalid address'), 'a': (501, b'5.1.3 Invalid address')} - Line : 7989 +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:27:49] "POST /myclass/api/Push_Document_To_ENT_For_Inscrit/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:15.968231 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:15.972233 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:15.976236 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:15.982234 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:15] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:15] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:16.920821 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:16.922819 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:16.925818 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:16.929821 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:16.934820 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:16.938816 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:16.941817 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:16] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:21.887160 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:21] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/ HTTP/1.1" 404 - +INFO:root:2025-06-07 21:28:26.768918 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:26] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/ HTTP/1.1" 404 - +INFO:root:2025-06-07 21:28:28.958926 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:28] "POST /myclass/api/Delete_Stored_Downloaded_File/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:29.089965 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:29] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:28:31.311091 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:28:31.318105 : Delete_Stored_Downloaded_File -myprint() takes from 0 to 1 positional arguments but 2 were given - ERRORRRR AT Line : 844 +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:28:31] "POST /myclass/api/Delete_Stored_Downloaded_File/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\Cherif\\Documents\\myclass.com\\Siteweb\\Elyos_Ftion_Initiale\\Ela_back\\Back_Office_FI\\attached_file_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2025-06-07 21:29:12.103318 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:29:12.103318 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:29:12.103318 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:29:12.103318 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:29:12.103318 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 479-264-725 +INFO:root:2025-06-07 21:29:15.552776 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:15.555808 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:15.557787 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:15.560785 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:15] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:15] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:15] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:15] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:16.561632 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:16.564629 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:16.567628 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:16.571147 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:16.575148 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:16.581149 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:16.588146 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:16] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:20.992657 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:22.475065 : Delete_Stored_Downloaded_File - Fichier invalide (2)= ./Data/cv02_20250607_124500_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:22] "POST /myclass/api/Delete_Stored_Downloaded_File/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:45.206549 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:47.012540 : send_invidual_email_for_ENT_Document_Notif -{'c': (421, b'4.7.0 Too many protocol errors (6) on this connection, closing transmission channel.'), 'o': (501, b'5.1.3 Invalid address'), 'n': (501, b'5.1.3 Invalid address'), 't': (501, b'5.1.3 Invalid address'), 'a': (501, b'5.1.3 Invalid address')} - Line : 7989 +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:47] "POST /myclass/api/Push_Document_To_ENT_For_Inscrit/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:51.943732 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:51.950732 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:51.953733 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:51.954728 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:51] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:51] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:51] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:51] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:52.864123 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:52.867635 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:52.872151 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:52.878151 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:52.884152 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:29:52.889150 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:52.896150 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:52] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:29:55.975396 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:55] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/ HTTP/1.1" 404 - +INFO:root:2025-06-07 21:29:57.232296 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:29:57] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/MySyProcessMetierAdapte_20250607212945_20250607_212946_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf HTTP/1.1" 200 - +INFO:root:2025-06-07 21:30:33.203824 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:30:33.209824 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:30:33.216353 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:30:33.220384 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:30:33.230368 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:30:33.234366 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/Get_Statgaire_List_Partner_with_filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/Get_Partner_List_Partner_Client/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/get_partner_class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:30:33] "POST /myclass/api/GetAllValideSessionPartner_List/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:31:01.829161 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:31:01.837182 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:31:01.845708 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:31:01.853715 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:31:01.860720 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/Get_Statgaire_List_Partner_with_filter/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:31:01.866704 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/Get_Partner_List_Partner_Client/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/get_partner_class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:31:01] "POST /myclass/api/GetAllValideSessionPartner_List/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\Cherif\\Documents\\myclass.com\\Siteweb\\Elyos_Ftion_Initiale\\Ela_back\\Back_Office_FI\\prj_common.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2025-06-07 21:31:24.580950 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:31:24.580950 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:31:24.580950 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:31:24.580950 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:31:24.580950 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 479-264-725 +INFO:werkzeug: * Detected change in 'C:\\Users\\Cherif\\Documents\\myclass.com\\Siteweb\\Elyos_Ftion_Initiale\\Ela_back\\Back_Office_FI\\prj_common.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2025-06-07 21:32:00.261593 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:32:00.262588 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:32:00.262588 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:32:00.262588 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:32:00.262588 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 479-264-725 +INFO:root:2025-06-07 21:32:00.323436 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:00.776547 : Delete_Stored_Downloaded_File -myprint() takes from 0 to 1 positional arguments but 2 were given - ERRORRRR AT Line : 830 +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:00] "POST /myclass/api/Delete_Stored_Downloaded_File/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\Cherif\\Documents\\myclass.com\\Siteweb\\Elyos_Ftion_Initiale\\Ela_back\\Back_Office_FI\\attached_file_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2025-06-07 21:32:43.924805 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2025-06-07 21:32:43.924805 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev_fi ++ +INFO:root:2025-06-07 21:32:43.925802 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev_fi') ++ +INFO:root:2025-06-07 21:32:43.925802 : ++ FLASK PORT 5001 ++ +INFO:root:2025-06-07 21:32:43.925802 : ++ LMS_BAS_URL mysy-hosting.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 479-264-725 +INFO:root:2025-06-07 21:32:44.137383 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.147380 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.151381 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.154381 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.175380 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.180381 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:32:44.196389 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.197389 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:32:44.201390 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:32:44.225902 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:32:44.231901 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:32:44] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:02.536246 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:02] "POST /myclass/api/Store_User_Downloaded_File/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:02.675722 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:02] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:42.700410 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:33:42.710428 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/Get_Statgaire_List_Partner_with_filter/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:42.726444 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/Get_Partner_List_Partner_Client/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:42.732780 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:33:42.739940 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/get_partner_class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:33:42.751564 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:33:42] "POST /myclass/api/GetAllValideSessionPartner_List/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:34:17.671058 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:34:17.675053 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:34:17.681100 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:34:17.686520 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:34:17.690518 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:34:17.694518 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/Get_Partner_List_Partner_Client/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/Get_Statgaire_List_Partner_with_filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/get_partner_class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:34:17] "POST /myclass/api/GetAllValideSessionPartner_List/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:07.764716 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:07.769715 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:07.775194 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/Get_Statgaire_List_Partner_with_filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/Get_Partner_List_Partner_Client/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:07.783704 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:07.787702 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:07.793707 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/Get_Partner_Object_Specific_Valide_Displayed_Fields/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/get_partner_class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:07] "POST /myclass/api/GetAllValideSessionPartner_List/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:25.219718 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:25] "POST /myclass/api/Push_Document_To_ENT_For_Inscrit/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:29.119083 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.121080 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.122079 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.124079 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:29.856228 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.859230 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.861228 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.866636 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:29.872645 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:29.877671 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:36:29.877671 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:29] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:33.984348 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:34] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/cv01_20250607_213302_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf HTTP/1.1" 200 - +INFO:root:2025-06-07 21:36:38.231727 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:36:38] "GET /myclass/api/Get_Stored_Downloaded_File/Vk_KQCcvST_LOUckxZOafiZzAkXyB_p2Jg/MySyProcessMetierAdapte_20250607213625_20250607_213625_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:06.154358 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:06.170360 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:06.170360 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:06] "POST /myclass/api/Get_Partner_Data_From_Subdomain/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:06] "POST /myclass/api/get_all_class_Given_partner_owner_recid_No_Login/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:08.130752 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:08.138973 : Ajout Token OK, _id = 6842a52997eb82bb3be50a80 +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:08] "POST /myclass/api/login/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:08.512080 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:08.519097 : {'_id': ObjectId('6843041ea83b1bf7474a1a23'), 'email': 'mysy1000formation+01_lot2@gmail.com', 'pwd': 'cherif', 'recid': 'de4b70ae40d84ba7d5470d2ea44b78a65cc2bc407fc24896d0', 'active': '1', 'locked': '0', 'date_update': '2022-10-10 14:34:53.715948', 'type': 'student', 'apprenant_id': '66b5eba08479169d46bfe2ba', 'firstconnexion': '0', 'lastconnexion': '2025-06-07 21:37:08.138973', 'token': 'eoNeeNAnwy87Bs4fShKBLNpQjwr_DjL4Ew'} +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:08] "POST /myclass/api/get_user_account/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:08.765070 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:08] "POST /myclass/api/Get_Ent_Student_List_Class/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:08.842852 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:08] "POST /myclass/api/getRecodedClassImage_no_token/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:09.126423 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:09.127438 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:09] "POST /myclass/api/GetActiveSessionFormation_List/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:09] "POST /myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:14.170597 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/get_Ent_Student_Given_Class_From_Class_Id/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:14.479483 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:14.480479 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:14.480479 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:14.482477 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:14.485477 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/Get_Ent_Student_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/Get_Ent_Student_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/Get_Ent_Student_Session_Sequence_List/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/Get_Ent_Student_Participant_Notes/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:14] "POST /myclass/api/Get_Ent_Student_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:18.983316 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:18] "GET /myclass/api/Get_Ent_Student_Stored_Downloaded_File/eoNeeNAnwy87Bs4fShKBLNpQjwr_DjL4Ew/cv01_20250607_213302_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf/66b5eba08479169d46bfe2ba HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:24.692131 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:24] "GET /myclass/api/Get_Ent_Student_Stored_Downloaded_File/eoNeeNAnwy87Bs4fShKBLNpQjwr_DjL4Ew/MySyProcessMetierAdapte_20250607213625_20250607_213625_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf/66b5eba08479169d46bfe2ba HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:31.328562 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:31] "POST /myclass/api/Delete_Stored_Downloaded_File/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:31.578018 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:31] "POST /myclass/api/Get_Ent_Student_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:33.427527 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:33] "POST /myclass/api/Get_Ent_Student_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:33.735906 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:33] "POST /myclass/api/Get_Ent_Student_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:38.024690 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:38.026693 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:38.027711 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:38.032697 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/get_Ent_Student_Given_Class_From_Class_Id/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:37:38.036210 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:37:38.038211 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/Get_Ent_Student_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/Get_Ent_Student_Session_Sequence_List/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/Get_Ent_Student_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/Get_Ent_Student_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:37:38] "POST /myclass/api/Get_Ent_Student_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:18.003036 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:18] "POST /myclass/api/Get_Ent_Student_List_Class/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:22.231678 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:22.234679 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:22.237678 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:22.240678 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:22] "POST /myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:22] "POST /myclass/api/Get_Inscrit_List_EU/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:22] "POST /myclass/api/Get_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:22] "POST /myclass/api/Get_Inscrit_List_EU_Type_Evaluation/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:23.242336 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:23.244337 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:23.247334 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:23.249335 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/Get_Partner_List_Partner_Client_with_filter_Like/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:23.255334 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:23.258332 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:23.262334 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/GetAttendeeDetail_perSession/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/getRecodedStagiaireImage_from_front/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/GetSessionFormation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/Get_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/Get_List_Jury_Soutenenace_With_Filter/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:23] "POST /myclass/api/Get_List_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:31.467000 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/get_Ent_Student_Given_Class_From_Class_Id/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:31.782708 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:31.785218 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:31.788211 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:31.793213 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2025-06-07 21:39:31.797212 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/Get_Ent_Student_List_Unite_Enseignement_Of_Given_Class/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/Get_Ent_Student_List_Class_Evaluation/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/Get_Ent_Student_Session_Sequence_List/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/Get_Ent_Student_List_object_owner_collection_Stored_Files/ HTTP/1.1" 200 - +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:31] "POST /myclass/api/Get_Ent_Student_Participant_Notes/ HTTP/1.1" 200 - +INFO:root:2025-06-07 21:39:35.232099 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jun/2025 21:39:35] "GET /myclass/api/Get_Ent_Student_Stored_Downloaded_File/eoNeeNAnwy87Bs4fShKBLNpQjwr_DjL4Ew/MySyProcessMetierAdapte_20250607213625_20250607_213625_43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89.pdf/66b5eba08479169d46bfe2ba HTTP/1.1" 304 - diff --git a/attached_file_mgt.py b/attached_file_mgt.py index ee4bcef..010c845 100644 --- a/attached_file_mgt.py +++ b/attached_file_mgt.py @@ -829,7 +829,7 @@ def Delete_Stored_Downloaded_File(diction): if (tmp_count <= 0): mycommon.myprint( str(inspect.stack()[0][ - 3]) + " - Fichier invalide = ", str(full_path)) + 3]) + " - Fichier invalide = ",+str(full_path)) return False, " - Fichier invalide " @@ -843,7 +843,7 @@ def Delete_Stored_Downloaded_File(diction): else: mycommon.myprint( str(inspect.stack()[0][ - 3]) + " - Fichier invalide (2)= ", str(full_path)) + 3]) + " - Fichier invalide (2)= "+ str(full_path)) return False, " - Fichier invalide (2) " diff --git a/email_mgt.py b/email_mgt.py index f757537..bcdef9b 100644 --- a/email_mgt.py +++ b/email_mgt.py @@ -3040,7 +3040,7 @@ def Prepare_and_Send_Email_From_Front(tab_files, Folder, diction): if val not in field_list and val.startswith('my_') is False: mycommon.myprint(str(inspect.stack()[0][ 3]) + " - Le champ '" + val + "' n'est pas autorisé") - return False, "Impossible de créer le stagiaire. Toutes les informations fournies ne sont pas valables" + return False, "Toutes les informations fournies ne sont pas valables" field_list_obligatoire = ['token', 'list_email_dest', 'related_collection', 'email_sujet', 'email_corps'] @@ -3346,9 +3346,7 @@ def Prepare_and_Send_Email_From_Front(tab_files, Folder, diction): alors on procede au stockage des fichier dans l'espace ENT de l'inscrit s'il a un compte ENT valide """ if( "store_file_in_ent" in diction.keys() and diction['store_file_in_ent'] == '1'): - print(" ### liste des fichiers tab_saved_file_full_path = ", tab_saved_file_full_path) - print(" ### liste des list_inscription_id = ", list_inscription_id) - + local_diction = {} local_diction['token'] = diction['token'] local_diction['tab_file_name'] = tab_saved_file_full_path @@ -3384,7 +3382,7 @@ def Prepare_and_Send_Email_From_Front_For_Unknown_Contact(tab_files, Folder, dic if val not in field_list and val.startswith('my_') is False: mycommon.myprint(str(inspect.stack()[0][ 3]) + " - Le champ '" + val + "' n'est pas autorisé") - return False, "Impossible de créer le stagiaire. Toutes les informations fournies ne sont pas valables" + return False, "Toutes les informations fournies ne sont pas valables" field_list_obligatoire = ['token', 'list_email_dest', 'related_collection', 'email_sujet', 'email_corps'] @@ -3635,8 +3633,17 @@ def send_invidual_email(diction): partner_SMTP_COUNT_port = diction['partner_SMTP_COUNT_port'] partner_SMTP_COUNT_From_User = diction['partner_SMTP_COUNT_From_User'] - tab_email_cc = diction['tab_email_cc'] - tab_email_bcc = diction['tab_email_bcc'] + if( "tab_email_cc" in diction.keys()): + tab_email_cc = diction['tab_email_cc'] + else: + tab_email_cc="" + + if( "tab_email_bcc" in diction.keys()): + tab_email_bcc = diction['tab_email_bcc'] + else: + tab_email_bcc = "" + + tab_files_to_attache_to_mail = diction['tab_files_to_attache_to_mail'] email_sujet = diction['email_sujet'] html_mime = diction['html_mime'] diff --git a/main.py b/main.py index 1374114..9237ff1 100644 --- a/main.py +++ b/main.py @@ -11453,7 +11453,7 @@ API qui permet d'envoyer des emails generés depuis le front pour les contact co def Prepare_and_Send_Email_From_Front(): # On recupere le corps (payload) de la requete payload = mycommon.strip_dictionary (request.form.to_dict()) - print(" ### Prepare_and_Send_Email_From_Front payload (trop long cherif) = ", payload) + print(" ### Prepare_and_Send_Email_From_Front payload (trop long cherif) = ") file = [] tab_files = [] if request.method == 'POST': @@ -13093,6 +13093,29 @@ def Get_Ent_Student_Stored_Downloaded_File(token, file_name, apprenant_id): return retval +""" +API pour publier des document dans l'espace ENT des apprenants +""" +@app.route('/myclass/api/Push_Document_To_ENT_For_Inscrit/', methods=['POST','GET']) +@crossdomain(origin='*') +def Push_Document_To_ENT_For_Inscrit(): + # On recupere le corps (payload) de la requete + payload = mycommon.strip_dictionary (request.form.to_dict()) + print(" ### Push_Document_To_ENT_For_Inscrit payload (trop long cherif) = ", payload) + file = [] + tab_files = [] + if request.method == 'POST': + # Create variable for uploaded file + tab_files = [] + for tmp in request.files.getlist("File"): + tab_files.append(tmp) + + print(" ### payloadpayloadpayload = ", payload) + status, retval = mycommon.Push_Document_To_ENT_For_Inscrit(tab_files, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload) + + return jsonify(status=status, message=retval) + + if __name__ == '__main__': print(" debut api") context = SSL.Context(SSL.SSLv23_METHOD) diff --git a/partner_order.py b/partner_order.py index abcb13a..a837c5c 100644 --- a/partner_order.py +++ b/partner_order.py @@ -7692,7 +7692,7 @@ def Insert_Quotation_To_Session(diction): for val in incom_keys: if val not in field_list and val.startswith('my_') is False: mycommon.myprint(str(inspect.stack()[0][3]) + " - Le champ '" + val + "' n'est pas autorisé") - return False, "Impossible de créer le stagiaire. Toutes les informations fournies ne sont pas valables" + return False, "Toutes les informations fournies ne sont pas valables" """ Verification de la liste des champs obligatoires @@ -8024,7 +8024,7 @@ def Insert_Quotation_To_Session_From_Partner_Owner_Recid(diction): for val in incom_keys: if val not in field_list and val.startswith('my_') is False: mycommon.myprint(str(inspect.stack()[0][3]) + " - Le champ '" + val + "' n'est pas autorisé") - return False, "Impossible de créer le stagiaire. Toutes les informations fournies ne sont pas valables" + return False, "Toutes les informations fournies ne sont pas valables" """ Verification de la liste des champs obligatoires diff --git a/prj_common.py b/prj_common.py index ea1f3bf..6cc25b3 100644 --- a/prj_common.py +++ b/prj_common.py @@ -2,6 +2,12 @@ import ast import hashlib import _pickle as cPickle import pickle +import smtplib +from email import encoders +from email.mime.base import MIMEBase +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText + from PIL import Image import requests import bson @@ -162,7 +168,6 @@ def Upload_Save_PDF_IMG_File(file=None, Folder=None): file.filename = new_file_name file.save(os.path.join(str(Folder), secure_filename(file.filename))) # t - Global_file_name = str(Folder) + str(file.filename) return True, Global_file_name @@ -7546,10 +7551,6 @@ def Ent_Student_Store_files(diction): print("### str(diction['tab_inscrit_ids']) = ", diction['tab_inscrit_ids']) - for dd in diction['tab_inscrit_ids']: - print( " ## dd = ", dd) - - """ Recuperer la liste des inscrits qui ont un compte """ @@ -7574,10 +7575,16 @@ def Ent_Student_Store_files(diction): for inscrit_id in tab_inscription_with_account_ids : for file_name in diction['tab_file_name']: + print(" ## file_nale = ", file_name) + + file_name_extract = os.path.basename(str(file_name)) + + print(" ## file_name_extract = ", file_name_extract) + new_file = {} new_file['token'] = diction['token'] type_document = "ent_document" - new_file['file_business_object'] = str(file_name) + new_file['file_business_object'] = str(file_name_extract) new_file['file_name'] = str(file_name) new_file['status'] = "1" new_file['type_document'] = str(type_document) @@ -7592,12 +7599,398 @@ def Ent_Student_Store_files(diction): if (local_status is False): print(" ## WARINNGGG Impossible de stocker le fichier dans l'espace ENT str(file_name) = ", str(file_name), " ## str(inscrit_id) = ", str(inscrit_id)) - - - return True, "Les fichiers ont été correctement stocké" except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)) - return False, " Impossible de stocker les fichiers dans l'espace ENT " \ No newline at end of file + return False, " Impossible de stocker les fichiers dans l'espace ENT " + + +""" +Fonction qui recupere des fichier et un liste d'inscrit et publie +les documents dans l'ENT +""" +def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction): + try: + diction = strip_dictionary(diction) + + field_list = ['token', 'list_email_dest', 'related_collection', 'list_inscription_id'] + incom_keys = diction.keys() + + for val in incom_keys: + if val not in field_list and val.startswith('my_') is False: + myprint(str(inspect.stack()[0][ + 3]) + " - Le champ '" + val + "' n'est pas autorisé") + return False, "Toutes les informations fournies ne sont pas valables" + + field_list_obligatoire = ['token', 'list_email_dest', 'related_collection', 'list_inscription_id'] + + for val in field_list_obligatoire: + if val not in diction: + myprint( + str(inspect.stack()[0][ + 3]) + " La valeur '" + val + "' n'est pas presente dans la liste des arguments ") + return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments" + + my_token = "" + if ("token" in diction.keys()): + if diction['token']: + my_token = diction['token'] + + local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction) + if (local_status is not True): + return local_status, my_partner + + list_inscription_id = str(diction['list_inscription_id']).split(",") + list_inscription_id_Objectid = [] + for tmp in list_inscription_id: + if (tmp): + list_inscription_id_Objectid.append((ObjectId(str(tmp)))) + + # print(" #### list_inscription_id = ", list_inscription_id) + + """ + Verifier la validité "related_collection" + """ + related_collection = str(diction['related_collection']).strip().lower() + if (related_collection not in MYSY_GV.EMAIL_DEST_RELATED_COLLECTION): + myprint( + str(inspect.stack()[0][ + 3]) + " Le champ 'related_collection' est invalide ") + return False, " Le champ 'related_collection' est invalide " + + local_partner_owner_recid = "partner_owner_recid" + if (related_collection == "contact"): + local_partner_owner_recid = "partner_recid" + + + + """ + Verifier la validité des emails de destinataire. + Si et SEULEMENT SI "related_collection" != "no_contact" + """ + tab_related_collection_id = [] + tab_email_dest = "" + if ("list_email_dest" in diction.keys()): + if diction['list_email_dest']: + tab_email_dest = diction['list_email_dest'] + + tab_email_dest = str(tab_email_dest).split(",") + for email_dest in tab_email_dest: + if (email_dest): + if (isEmailValide(str(email_dest)) is False): + myprint( + str(inspect.stack()[0][3]) + " L'adresse email '" + str(email_dest) + "' est invalide ") + return False, "L'adresse email '" + str(email_dest) + "' est invalide" + + is_valide_email_in_related_collection = MYSY_GV.dbname[str(related_collection)].count_documents( + {"email": str(email_dest), + 'valide': '1', + local_partner_owner_recid: str(my_partner['recid']), + '_id': { + '$in': list_inscription_id_Objectid}, + }) + + if (is_valide_email_in_related_collection != 1): + myprint( + str(inspect.stack()[0][ + 3]) + " L'adresse email '" + str(email_dest) + "' existe pas dans le système ") + return False, " L'adresse email '" + str(email_dest) + "'existe pas dans le système " + + is_valide_email_in_related_collection_data = MYSY_GV.dbname[str(related_collection)].find_one( + {"email": str(email_dest), + 'valide': '1', + local_partner_owner_recid: str(my_partner['recid']), + '_id': { + '$in': list_inscription_id_Objectid}, + }, {'_id': 1}) + + tab_related_collection_id.append(str(is_valide_email_in_related_collection_data['_id'])) + + # print(" ### la liste _id des destinataire est ", str(tab_related_collection_id)) + + if (len(tab_email_dest) > MYSY_GV.EMAIL_MAX_DESTINAIRE): + myprint( + "Vous ne pouvez pas envoyer plus de " + str(MYSY_GV.EMAIL_MAX_DESTINAIRE) + " emails à la fois.") + return False, "Vous ne pouvez pas envoyer plus de " + str( + MYSY_GV.EMAIL_MAX_DESTINAIRE) + " emails à la fois." + + # Sauvegarde des fichiers joints depuis le front + if (len(tab_files) > MYSY_GV.EMAIL_MAX_PJ): + myprint("Vous ne pouvez pas envoyer plus de " + str(MYSY_GV.EMAIL_MAX_PJ) + " pièces jointes.") + return False, "Vous ne pouvez pas envoyer plus de " + str(MYSY_GV.EMAIL_MAX_PJ) + " pièces jointes. " + + tab_saved_file_full_path = [] + for file in tab_files: + status, saved_file_full_path = Upload_Save_PDF_IMG_File(file, Folder) + if (status is False): + myprint("Impossible de récupérer correctement le fichier à importer") + return False, "Impossible de récupérer correctement le fichier à importer" + + tab_saved_file_full_path.append(saved_file_full_path) + + # Traitement de l'eventuel fichier joint + tab_files_to_attache_to_mail = [] + for saved_file in tab_saved_file_full_path: + file_to_attache_to_mail = MIMEBase('application', "octet-stream") + file_to_attache_to_mail.set_payload(open(saved_file, "rb").read()) + + encoders.encode_base64(file_to_attache_to_mail) + file_to_attache_to_mail.add_header('Content-Disposition', + 'attachment; filename="{0}"'.format(os.path.basename(saved_file))) + + new_node = {"attached_file": file_to_attache_to_mail} + tab_files_to_attache_to_mail.append(new_node) + + + + local_diction = {} + local_diction['token'] = diction['token'] + local_diction['tab_file_name'] = tab_saved_file_full_path + local_diction['tab_inscrit_ids'] = list_inscription_id + + local_status, local_retval = Ent_Student_Store_files(local_diction) + if (local_status is False): + print(" ### WARINNGGG Impossible de stocker les fichiers dans l'espace ENT") + + """ + Envoie des email de notification des apprenants + + + # Recuperation des donnes SMTP + local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = Get_Partner_SMTP_Param( + my_partner['recid']) + + if (local_stpm_status is False): + return local_stpm_status, partner_own_smtp_value + + smtpserver = None + + if (str(partner_own_smtp_value) == "1"): + smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port) + else: + smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port) + + smtpserver.ehlo() + smtpserver.starttls() + smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password) + cpt_email_envoye = 0 + + + for user_id in tab_related_collection_id: + + user_related_collection_data = MYSY_GV.dbname[str(related_collection)].find_one( + {"_id": ObjectId(str(user_id)), + 'valide': '1', + local_partner_owner_recid: str(my_partner['recid']) + }, {'_id': 1, 'email': 1, 'nom': 1, 'prenom': 1}) + + nom = "" + prenom = "" + email = "" + + if ("nom" in user_related_collection_data.keys()): + nom = user_related_collection_data['nom'] + + if ("prenom" in user_related_collection_data.keys()): + prenom = user_related_collection_data['prenom'] + + if ("email" in user_related_collection_data.keys()): + email = user_related_collection_data['email'] + + # Creation du dictionnaire d'information à utiliser pour la creation du doc + convention_dictionnary_data = {} + new_diction = {} + new_diction['token'] = my_partner['token'] + new_diction['list_stagiaire_id'] = [] + new_diction['list_session_id'] = [] + new_diction['list_class_id'] = [] + new_diction['list_client_id'] = [] + + local_status, local_retval = Get_Dictionnary_data_For_Template(new_diction) + + if (local_status is False): + return local_status, local_retval + + convention_dictionnary_data = local_retval + + node = {} + convention_dictionnary_data['nom'] = nom + convention_dictionnary_data['prenom'] = prenom + body = { + "params": convention_dictionnary_data, + } + + # Creation de l'email à enoyer zzzz + msg = MIMEMultipart("alternative") + + html = ''' + + + + +

Nouveau document dans votre espace ENT

+ Bonjour {nom} {prenom},
+ + Vous avez un nouveau document dans votre espace ENT. +
+ + + '''.format(nom=str(user_related_collection_data['nom']), + prenom=str(user_related_collection_data['prenom'])) + + html_mime = MIMEText(html, 'html') + + local_diction = {} + local_diction['token'] = diction['token'] + local_diction['partner_own_smtp_value'] = partner_own_smtp_value + local_diction['partner_SMTP_COUNT_smtpsrv'] = partner_SMTP_COUNT_smtpsrv + local_diction['partner_SMTP_COUNT_port'] = partner_SMTP_COUNT_port + local_diction['user_id'] = user_id + local_diction['related_collection'] = related_collection + local_diction['partner_SMTP_COUNT_From_User'] = partner_SMTP_COUNT_From_User + + local_diction['tab_email_bcc'] = "contact@mysy-training.com" + local_diction['tab_files_to_attache_to_mail'] = tab_files_to_attache_to_mail + local_diction['email_sujet'] = "Nouveau document dans votre espace ENT" + local_diction['html_mime'] = html_mime + local_diction['email'] = email + local_diction['partner_owner_recid'] = str(my_partner['recid']) + + if ("include_client" in diction.keys()): + local_diction['include_client'] = diction['include_client'] + else: + local_diction['include_client'] = "0" + + if ("include_tuteur" in diction.keys()): + local_diction['include_tuteur'] = diction['include_tuteur'] + else: + local_diction['include_tuteur'] = "0" + + # print(" ### local_diction = ", local_diction) + local_status, local_retval = send_invidual_email_for_ENT_Document_Notif(local_diction) + if (local_status is False): + return local_status, local_retval + + cpt_email_envoye = cpt_email_envoye + 1 + + print(" NB_email envoyé = ", cpt_email_envoye) + """ + return True, " Les documents ont été publiés" + + except Exception as e: + exc_type, exc_obj, exc_tb = sys.exc_info() + myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)) + return False, " Impossible de publier les documents dans l'espace ENT " + +""" +Envoie email de notif pour le partage de document sur l'ENT +""" +def send_invidual_email_for_ENT_Document_Notif(diction): + try: + diction = strip_dictionary(diction) + + my_token = "" + if ("token" in diction.keys()): + if diction['token']: + my_token = diction['token'] + + local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction) + if (local_status is not True): + return local_status, my_partner + + smtpserver = None + + partner_own_smtp_value = diction['partner_own_smtp_value'] + partner_SMTP_COUNT_smtpsrv = diction['partner_SMTP_COUNT_smtpsrv'] + partner_SMTP_COUNT_port = diction['partner_SMTP_COUNT_port'] + + partner_SMTP_COUNT_From_User = diction['partner_SMTP_COUNT_From_User'] + if( "tab_email_cc" in diction.keys()): + tab_email_cc = diction['tab_email_cc'] + else: + tab_email_cc="" + + if( "tab_email_bcc" in diction.keys()): + tab_email_bcc = diction['tab_email_bcc'] + else: + tab_email_bcc = "" + + + tab_files_to_attache_to_mail = diction['tab_files_to_attache_to_mail'] + email_sujet = diction['email_sujet'] + html_mime = diction['html_mime'] + email = diction['email'] + user_id = diction['user_id'] + related_collection = diction['related_collection'] + + partner_owner_recid = diction['partner_owner_recid'] + + + # Recuperer les données tuteurs + + if(related_collection == "inscription" ): + + inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(user_id)), + 'partner_owner_recid':str(partner_owner_recid)}, + ) + + + if (str(partner_own_smtp_value) == "1"): + smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port) + else: + smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port) + + smtpserver.ehlo() + smtpserver.starttls() + smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password) + cpt_email_envoye = 0 + + """ + Envoie proprement-dit des emails + """ + + # Creation de l'email à enoyer + msg = MIMEMultipart("alternative") + + if (str(partner_own_smtp_value) == "1"): + msg.attach(html_mime) + msg['From'] = partner_SMTP_COUNT_From_User + msg['Cc'] = ",".join(tab_email_cc) + msg['Bcc'] = ",".join(tab_email_bcc) + msg['Subject'] = email_sujet + msg['to'] = str(email) + + # Attacher l'eventuelle pièces jointes + for myfile in tab_files_to_attache_to_mail: + msg.attach(myfile['attached_file']) + + val = smtpserver.send_message(msg) + print(" Email a envoyé " + str(email)) + cpt_email_envoye = cpt_email_envoye + 1 + + else: + msg.attach(html_mime) + msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User + msg['Cc'] = ",".join(tab_email_cc) + msg['Bcc'] = ",".join(tab_email_bcc) + msg['Subject'] = email_sujet + msg['to'] = str(email) + + # Attacher l'eventuelle pièces jointes + for myfile in tab_files_to_attache_to_mail: + msg.attach(myfile['attached_file']) + + val = smtpserver.send_message(msg) + print(" Email a envoyé " + str(email)) + cpt_email_envoye = cpt_email_envoye + 1 + + smtpserver.close() + + return True, " Les emails ont été correctement envoyés" + + except Exception as e: + exc_type, exc_obj, exc_tb = sys.exc_info() + myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)) + return False, " Impossible d'envoyer les emails "