30/05/22 - 19h30
parent
fa979638f6
commit
fb7e13e816
14
Ela_Spacy.py
14
Ela_Spacy.py
|
@ -69,7 +69,7 @@ def correct_fr_word(word):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
'''
|
||||
|
@ -471,7 +471,7 @@ def ela_index_record_field(lines, class_id, source_field = ""):
|
|||
if (status is False):
|
||||
return False
|
||||
|
||||
print(" AVANT STEM " + str(tab_tokens3))
|
||||
#print(" AVANT STEM " + str(tab_tokens3))
|
||||
# Mettre en unicode et virer d'autre stop word
|
||||
tab_tokens3_unicode = []
|
||||
for val in tab_tokens3:
|
||||
|
@ -488,7 +488,7 @@ def ela_index_record_field(lines, class_id, source_field = ""):
|
|||
if (status is True):
|
||||
tab_tokens3_unicode.append(newword)
|
||||
|
||||
print("TTTTT " + str(tab_tokens3_unicode))
|
||||
#print("TTTTT " + str(tab_tokens3_unicode))
|
||||
|
||||
|
||||
status, tab_tokens4 = Ela_stemmize_Class(tab_tokens3)
|
||||
|
@ -511,7 +511,7 @@ def ela_index_record_field(lines, class_id, source_field = ""):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -605,7 +605,7 @@ def YTUBES_ela_index_record_field(lines, class_id, source_field = ""):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -834,7 +834,7 @@ def ela_index_article_avis_record_field(lines, article_avis_id, source_field = "
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -881,6 +881,6 @@ def Ela_article_avis_list_to_mongo(tab_tokens, traning_id, source_field):
|
|||
return True
|
||||
except Exception as e :
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ QUERY_LIMIT_ROW = 50
|
|||
'''
|
||||
Cette variable definit le nombre max
|
||||
retour à faire sur page d'acceuil '''
|
||||
MAINPAGE_QUERY_LIMIT_ROW = 50
|
||||
MAINPAGE_QUERY_LIMIT_ROW = 500
|
||||
|
||||
|
||||
'''
|
||||
|
|
|
@ -96,7 +96,7 @@ def get_all_articles_avis(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer les articles et avis"
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ def get_articles_avis(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer l'article/avis"
|
||||
|
||||
|
||||
|
@ -380,7 +380,7 @@ def add_articles_avis(diction):
|
|||
mydata['date_avis'] = str(datetime.now())
|
||||
mydata['isalaune'] = "0"
|
||||
|
||||
print(mydata)
|
||||
#print(mydata)
|
||||
|
||||
coll_name = dbname['articles_avis']
|
||||
ret_val = coll_name.insert_one(mydata)
|
||||
|
@ -425,7 +425,7 @@ def add_articles_avis(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de créer l'article/avis"
|
||||
|
||||
|
||||
|
@ -556,7 +556,7 @@ def recherche_articles_avis(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recherche un article/avis"
|
||||
|
||||
'''
|
||||
|
@ -679,7 +679,7 @@ def store_recherche_article_avis(diction, user_recid=""):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'enregistrer la recherche", None
|
||||
|
||||
|
||||
|
@ -744,11 +744,11 @@ def get_article_avis_alaune(diction):
|
|||
user = x
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
|
||||
print(" getObject = ", str(insertObject))
|
||||
#print(" getObject = ", str(insertObject))
|
||||
return True, insertObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de recuperer les articles à la Une"
|
114
class_mgt.py
114
class_mgt.py
|
@ -199,7 +199,7 @@ def add_class(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'ajouter la formation"
|
||||
|
||||
|
||||
|
@ -896,7 +896,7 @@ def get_class(diction):
|
|||
if ("_id" in mydict_combined.keys()):
|
||||
mydict_combined['class_id'] = mydict_combined.pop('_id')
|
||||
|
||||
mycommon.myprint("COMBINED = " + str(mydict_combined))
|
||||
#mycommon.myprint("COMBINED = " + str(mydict_combined))
|
||||
|
||||
'''
|
||||
Statistique : Insertion du recherche - resultat '''
|
||||
|
@ -945,6 +945,110 @@ def get_class(diction):
|
|||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
|
||||
'''
|
||||
Cette API retour une formation "coup de coeur".
|
||||
elle effectue les controles necessaires et retour la formation
|
||||
'''
|
||||
def get_class_coup_de_coeur(diction):
|
||||
try:
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
|
||||
'user_postal', 'user_latitude', 'user_longitude', 'user_state']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+ " - Creation partner account : Le champ '" + val + "' n'existe pas, Creation formation annulée")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['token']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# recuperation des paramettre
|
||||
mydata = {}
|
||||
my_internal_url = ""
|
||||
my_token = ""
|
||||
|
||||
|
||||
if ("internal_url" in diction.keys()):
|
||||
if diction['internal_url']:
|
||||
my_internal_url = diction['internal_url']
|
||||
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
|
||||
|
||||
coll_name = dbname['myclass']
|
||||
|
||||
|
||||
RetObject = []
|
||||
filt_external_code = {}
|
||||
internal_url = ""
|
||||
if ("internal_url" in diction.keys()):
|
||||
internal_url = str(diction['internal_url'])
|
||||
|
||||
print(" laaaa internal_url = "+internal_url)
|
||||
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'coeur':'1'},
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
|
||||
):
|
||||
|
||||
print(" retval "+str(retVal))
|
||||
|
||||
if ("description" in retVal.keys()):
|
||||
tmp_str = retVal['description']
|
||||
if (len(retVal['description']) > MYSY_GV.MAX_CARACT_DETAIL):
|
||||
retVal['description'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
||||
|
||||
|
||||
if ("objectif" in retVal.keys()):
|
||||
tmp_str = retVal['objectif']
|
||||
if (len(retVal['objectif']) > MYSY_GV.MAX_CARACT_DETAIL):
|
||||
retVal['objectif'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
||||
|
||||
|
||||
|
||||
if ("programme" in retVal.keys()):
|
||||
tmp_str = retVal['programme']
|
||||
if (len(retVal['programme']) > MYSY_GV.MAX_CARACT_DETAIL):
|
||||
retVal['programme'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
||||
|
||||
|
||||
if ("pedagogie" in retVal.keys()):
|
||||
tmp_str = retVal['pedagogie']
|
||||
if (len(retVal['pedagogie']) > MYSY_GV.MAX_CARACT_DETAIL):
|
||||
retVal['pedagogie'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
||||
|
||||
|
||||
mycommon.myprint(str(retVal))
|
||||
user = retVal
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e)+" - Line : "+ str(exc_tb.tb_lineno) )
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
cette fonction recherche et retour une formation dont le proprietaire est le partenaire "partenaire_rec_id"
|
||||
|
@ -1098,7 +1202,7 @@ def get_class_global_search(search_string):
|
|||
return insertObject
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1121,7 +1225,7 @@ def get_all_class_by_attribut(attribut, value):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1230,5 +1334,5 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'inserer les formation en masse "
|
||||
|
|
|
@ -180,7 +180,7 @@ def ela_index_class(external_code="", source_field = ""):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -232,7 +232,7 @@ def ela_index_all_classes():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||
|
||||
'''
|
||||
|
@ -266,7 +266,7 @@ def ela_index_all_classes_keywords():
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||
|
||||
'''
|
||||
|
@ -316,7 +316,7 @@ def ela_index_all_classes_title():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||
|
||||
|
||||
|
@ -371,7 +371,7 @@ def ela_index_all_classes_desc():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||
|
||||
|
||||
|
@ -423,7 +423,7 @@ def ela_index_all_classes_obj():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||
|
||||
|
||||
|
@ -474,7 +474,7 @@ def ela_index_all_classes_video_text():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer video_text la BDD des formations ==> KO"
|
||||
|
||||
|
||||
|
@ -563,7 +563,7 @@ def ela_recherche_tokens(sentence):
|
|||
return tab_training_id
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -638,7 +638,7 @@ def mysy_recherche_levenshtein(tab_mot):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
||||
|
||||
|
@ -724,7 +724,7 @@ def ela_recherche_tokens_source_field(sentence, source_fied=""):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Traitement impossible "
|
||||
|
||||
''''
|
||||
|
@ -760,7 +760,7 @@ def ela_index_all_articles_avis():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'indexer les articles et avis ==> KO"
|
||||
|
||||
|
||||
|
@ -808,7 +808,7 @@ def ela_index_articles_avis(titre_formation="", source_field = ""):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ def get_user_objectif(diction):
|
|||
|
||||
RetObject = []
|
||||
for retVal in coll_name.find(query):
|
||||
mycommon.myprint(retVal)
|
||||
#mycommon.myprint(retVal)
|
||||
user = retVal
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
|
@ -121,7 +121,7 @@ def get_user_objectif(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer les objectifs de l'utilisateur"
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ def desable_user_objectif(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de desactivier cette formation"
|
||||
|
||||
|
||||
|
@ -321,7 +321,7 @@ def add_update_user_objectif(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de mettre à jour les objectifs utilisateur"
|
||||
|
||||
|
||||
|
@ -398,7 +398,7 @@ def add_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de créer le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -435,7 +435,7 @@ def valide_user_account(value):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de valider le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -592,7 +592,7 @@ def update_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le compte utilisateur"
|
||||
|
||||
'''
|
||||
|
@ -667,7 +667,7 @@ def get_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer le user account"
|
||||
|
||||
|
||||
|
@ -778,7 +778,7 @@ def change_user_pwd(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le mot de passe de l'utilisateur"
|
||||
|
||||
|
||||
|
@ -889,7 +889,7 @@ def Reset_user_pwd_by_token(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le mot de passe de l'utilisateur"
|
||||
|
||||
|
||||
|
@ -976,7 +976,7 @@ def change_uer_email(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour l'email principal"
|
||||
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ def send_mail_delete_user(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de supprimer le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ def delete_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de supprimer le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -1283,7 +1283,7 @@ def lock_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ def desable_user_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le compte utilisateur"
|
||||
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ def get_user_recherche_history(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de recuperer l'historique de recherche"
|
||||
|
||||
|
||||
|
@ -1560,7 +1560,7 @@ def InitUserPasswd(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de reinitialiser le mot de passe de l'utiilisateur"
|
||||
|
||||
|
||||
|
@ -1611,6 +1611,6 @@ def IsUserTokenValide(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de verifier la validité du token"
|
||||
|
||||
|
|
10
email_mgt.py
10
email_mgt.py
|
@ -112,7 +112,7 @@ def send_user_account_mail(message, account_mail):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ def send_partner_account_mail(message, account_mail):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification"
|
||||
|
||||
|
||||
|
@ -278,7 +278,7 @@ def send_user_init_pwd_mail(token, account_mail):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
|
@ -369,7 +369,7 @@ Le échéant, vous pouvez finaliser la suppression de votre compte en cliquant s
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
|
@ -436,5 +436,5 @@ def SendGenericEmail(mail_recever=None, mail_object=None, mail_message=None):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
31
main.py
31
main.py
|
@ -1042,10 +1042,24 @@ def Migration_internal_url():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### payload = ", payload)
|
||||
status, result = mycommon.Migration_internal_url()
|
||||
status, result = "none", "none", #mycommon.Migration_internal_url()
|
||||
return jsonify(status=status, message=result)
|
||||
|
||||
|
||||
'''
|
||||
Correction erreur title mymooc.com
|
||||
'''
|
||||
@app.route('/myclass/api/Migration_mooc_title/', methods=['GET','POST'])
|
||||
@crossdomain(origin='*')
|
||||
def Migration_mooc_title():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### payload = ", payload)
|
||||
status, result = "none", "none", #mycommon.Migration_mooc_title()
|
||||
return jsonify(status=status, message=result)
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Cette API va aller chercher dans la collection "elaindex"
|
||||
les mots qui contiennent le mot "mot"'''
|
||||
|
@ -1058,6 +1072,21 @@ def GetMotFromElaIndex():
|
|||
status, result = mycommon.GetMotFromElaIndex(payload)
|
||||
return jsonify(status=status, message=result)
|
||||
|
||||
'''
|
||||
Cette API retour une formation "coup de coeur" apres
|
||||
avoir effectué tous les controles
|
||||
'''
|
||||
@app.route('/myclass/api/get_class_coup_de_coeur/', methods=['GET','POST'])
|
||||
@crossdomain(origin='*')
|
||||
def get_class_coup_de_coeur():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### payload = ", payload)
|
||||
status, result = cm.get_class_coup_de_coeur(payload)
|
||||
return jsonify(status=status, message=result)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
14
partners.py
14
partners.py
|
@ -163,7 +163,7 @@ def add_partner_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de créer le partenaire"
|
||||
|
||||
|
||||
|
@ -262,7 +262,7 @@ def update_partner_main_mail(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour l'adresse mail du partenaire"
|
||||
|
||||
|
||||
|
@ -365,7 +365,7 @@ def update_partner_pwd(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le mot de passe du partenaire"
|
||||
|
||||
|
||||
|
@ -511,7 +511,7 @@ def update_partner_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le partenaire"
|
||||
|
||||
|
||||
|
@ -554,7 +554,7 @@ def valide_partnair_account(value):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de valider le compte"
|
||||
|
||||
|
||||
|
@ -628,7 +628,7 @@ def get_partner_account(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
|
||||
|
@ -729,5 +729,5 @@ def partner_login(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
|
143
prj_common.py
143
prj_common.py
|
@ -1,3 +1,5 @@
|
|||
import hashlib
|
||||
|
||||
from pymongo import MongoClient
|
||||
import pymongo
|
||||
from difflib import SequenceMatcher
|
||||
|
@ -76,7 +78,7 @@ def Upload_Save_CSV_File(file=None, Folder=None):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
||||
|
||||
|
@ -99,7 +101,7 @@ def check_token_validity(email="", token=""):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
'''
|
||||
|
@ -130,7 +132,7 @@ def check_user_validity(email="", token=""):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, message
|
||||
|
||||
|
||||
|
@ -155,7 +157,7 @@ def check_partner_token_validity(email="", token=""):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -209,7 +211,7 @@ def get_user_email_from_recid(recid = ""):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de supprimer le compte utilisateur"
|
||||
|
||||
'''
|
||||
|
@ -252,10 +254,10 @@ def Create_internal_call_ref():
|
|||
|
||||
def textdist():
|
||||
val = textdistance.mra("doe", "dough")
|
||||
print(" mra = "+str(val))
|
||||
#print(" mra = "+str(val))
|
||||
|
||||
val2 = textdistance.editex("doe", "dough")
|
||||
print(" editex = " + str(val2))
|
||||
#print(" editex = " + str(val2))
|
||||
|
||||
|
||||
def similaire():
|
||||
|
@ -263,9 +265,9 @@ def similaire():
|
|||
ratio = 0.8
|
||||
|
||||
for mot in mots:
|
||||
print(" CMP de 'Dupont' et '"+mot+"'" )
|
||||
#print(" CMP de 'Dupont' et '"+mot+"'" )
|
||||
my_ratio = SequenceMatcher(None, "Dupont", mot).ratio()
|
||||
print(" ## RATION = "+str(my_ratio))
|
||||
#print(" ## RATION = "+str(my_ratio))
|
||||
|
||||
|
||||
#resultat = [mot for mot in mots if SequenceMatcher(None, "Dupont", mot).ratio() >= ratio]
|
||||
|
@ -307,7 +309,7 @@ def levenshtein(mot1,mot2):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
||||
|
||||
|
@ -355,7 +357,7 @@ def Word_Not_Stemmize(word = None):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de verifier Word_Not_Stemmize"
|
||||
|
||||
|
||||
|
@ -394,7 +396,7 @@ def check_word_in_fr_dict(mot=None):
|
|||
return True
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -415,7 +417,7 @@ def recherche_check_word_in_fr_dict(mot=None):
|
|||
return True
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -435,7 +437,7 @@ def check_source_ipv4(source_ip=None):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -470,7 +472,7 @@ def Parse_Clean_Search_Text(sentence=None):
|
|||
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, ""
|
||||
|
||||
|
||||
|
@ -492,7 +494,7 @@ def Get_Extended_Result(sentence=None):
|
|||
return True, external_code_prefixe
|
||||
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))
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, []
|
||||
|
||||
|
||||
|
@ -528,7 +530,7 @@ def RunSearchAPI(search_text=None, external_code_prefixe=None):
|
|||
|
||||
my_collection = MYSY_GV.YTUBES_dbname['mysyserpapi']
|
||||
|
||||
mycommon.myprint("resutlat 1 organic_results ")
|
||||
#mycommon.myprint("resutlat 1 organic_results ")
|
||||
cmpt = 0
|
||||
for val in organic_results:
|
||||
cmpt = cmpt +1
|
||||
|
@ -641,7 +643,7 @@ def CreateMyCode():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, '-1'
|
||||
|
||||
|
||||
|
@ -724,7 +726,7 @@ def CronUSerMessage_Mail():
|
|||
return True, str(my_today), str(nb_message) + " traite (s) : OK"
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False,str(datetime.today()), " Impossible de traiter les demandes d'envoi d'email "
|
||||
|
||||
|
||||
|
@ -760,7 +762,7 @@ def RendomizeTab(table):
|
|||
return True, new_tab
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, []
|
||||
|
||||
|
||||
|
@ -791,7 +793,7 @@ def Reordertab():
|
|||
return True, new_tab
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, []
|
||||
|
||||
|
||||
|
@ -849,21 +851,75 @@ def FormationAlaUne():
|
|||
return True, "ok"
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "KO"
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Cette fonction replace les caractères speciaux et ponctuation par des space
|
||||
'''
|
||||
def local_Remove_Ponct_Special_Caractere(sentence):
|
||||
try:
|
||||
text = sentence.lower() # mettre les mots en minuscule
|
||||
|
||||
# Retirons les caractères spéciaux :
|
||||
text = re.sub(r"[,\!\?\%\(\)\/\"]", " ", text)
|
||||
text = re.sub(r"\&\S*\s", " ", text)
|
||||
text = re.sub(r"\-", " ", text)
|
||||
|
||||
list_noises = ['...', '.', ';', ',', ':', '!', '?', ')', '(', '[', ']', '\'', '"', '’', '`','©', '–',
|
||||
'{', '}', '-', '=', '°', '#', '-', '/', '~', '&', '\\', '.', '^', '$', '*', '+','\\n','\n',
|
||||
'?', '{', '}', '[', ']', '|', '(', ')', '-', '>', '<', '@','®', '™', '«', '»']
|
||||
|
||||
sentence = text
|
||||
for noise in list_noises:
|
||||
#print(" suppression de : '"+str(noise)+"' ")
|
||||
sentence = sentence.replace(str(noise), " ")
|
||||
|
||||
#print(" AFTER REPLACE NOISES = "+str(sentence))
|
||||
return True, sentence
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e)+" - Line : "+ str(exc_tb.tb_lineno) )
|
||||
return False, " Impossible Ela_Remove_Ponct_Special_Caractere"
|
||||
|
||||
def Migration_internal_url():
|
||||
try:
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
for retVal in coll_name.find({}):
|
||||
user = retVal
|
||||
|
||||
my_internal_url = str(user['title'])
|
||||
local_status, my_internal_url = mycommon.local_Remove_Ponct_Special_Caractere(my_internal_url)
|
||||
my_internal_url = unidecode(my_internal_url.lower())
|
||||
my_internal_url = my_internal_url.replace(" ", "-")
|
||||
my_internal_url = my_internal_url.replace("/", "-")
|
||||
if (my_internal_url.startswith('-')):
|
||||
my_internal_url = my_internal_url[1:]
|
||||
|
||||
if (my_internal_url.endswith('-')):
|
||||
my_internal_url = my_internal_url[:-1]
|
||||
|
||||
|
||||
suffix = hashlib.md5(my_internal_url.encode()).hexdigest()
|
||||
|
||||
new_internal_url = str(my_internal_url) + "-" + str(suffix[-3:])
|
||||
|
||||
new_internal_url = new_internal_url.replace("---", "-")
|
||||
new_internal_url = new_internal_url.replace("--", "-")
|
||||
|
||||
print('new_internal_url = '+new_internal_url)
|
||||
|
||||
|
||||
|
||||
|
||||
result = coll_name.update_many(
|
||||
{'_id':ObjectId(str(user['_id']))},
|
||||
{
|
||||
"$set": {"internal_url": str(user['_id'])}
|
||||
"$set": {"internal_url": str(new_internal_url)}
|
||||
})
|
||||
'''print("raw:", result.raw_result)
|
||||
print("acknowledged:", result.acknowledged)
|
||||
|
@ -873,7 +929,7 @@ def Migration_internal_url():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "KO"
|
||||
|
||||
|
||||
|
@ -939,5 +995,40 @@ def GetMotFromElaIndex(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, []
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, []
|
||||
|
||||
|
||||
|
||||
'''
|
||||
correction erreur titre mymooc.com
|
||||
'''
|
||||
|
||||
def Migration_mooc_title():
|
||||
try:
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
for retVal in coll_name.find({'owner':'mymooc.com'}):
|
||||
|
||||
new_title = str(retVal['title'])
|
||||
|
||||
new_title = new_title.replace("-", " ")
|
||||
if (new_title.startswith('-')):
|
||||
new_title = new_title[1:]
|
||||
|
||||
if (new_title.endswith('-')):
|
||||
new_title = new_title[:-1]
|
||||
|
||||
|
||||
print(" new_title = "+new_title)
|
||||
result = coll_name.update_many(
|
||||
{'_id': ObjectId(str(retVal['_id']))},
|
||||
{
|
||||
"$set": {"title": str(new_title)}
|
||||
})
|
||||
|
||||
return True, "ok"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "KO"
|
||||
|
|
|
@ -71,7 +71,7 @@ def mysy_recherche_levenshtein_orig():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
||||
def mysy_recherche_levenshtein(tab_mot):
|
||||
|
@ -133,5 +133,5 @@ def mysy_recherche_levenshtein(tab_mot):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
|
|
@ -173,7 +173,7 @@ def add_user_message(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'ajouter le message"
|
||||
|
||||
|
||||
|
|
|
@ -139,5 +139,5 @@ def login(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de se connecter, merci de contacter le support technique"
|
23
wrapper.py
23
wrapper.py
|
@ -67,7 +67,7 @@ def get_recherche_gle_class(sentence):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ def get_class_by_list_attr(attribut, list_values):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -116,7 +116,7 @@ def update_class_by_attribut(objId, attribut, value):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -189,7 +189,7 @@ def get_all_class(diction):
|
|||
"valide": 0, "locked": 0, "partner_owner_recid": 0, }).\
|
||||
limit(MYSY_GV.MAINPAGE_QUERY_LIMIT_ROW).\
|
||||
sort(
|
||||
[ ("_id", pymongo.DESCENDING),]):
|
||||
[ ("coeur", pymongo.DESCENDING), ("date_update", pymongo.DESCENDING),]):
|
||||
|
||||
|
||||
|
||||
|
@ -208,11 +208,11 @@ def get_all_class(diction):
|
|||
insertObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
#mycommon.myprint(" insertObject = ", insertObject)
|
||||
#print(" insertObject = ", str(insertObject))
|
||||
return True, insertObject
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer les formations"
|
||||
|
||||
|
||||
|
@ -476,6 +476,7 @@ def recherche_text_simple(diction):
|
|||
{"_id": 0, "indexed": 0, "indexed_desc": 0,
|
||||
"indexed_obj": 0, "indexed_title": 0, "valide": 0,
|
||||
"locked": 0, "partner_owner_recid": 0, }):
|
||||
|
||||
nb_result = nb_result + 1
|
||||
my_recid = {}
|
||||
my_recid['user_rec_id'] = str(user_recid)
|
||||
|
@ -564,7 +565,7 @@ def recherche_text_simple(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de lancer la recherche"
|
||||
|
||||
|
||||
|
@ -737,7 +738,7 @@ def store_recherche(diction, user_recid=""):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'enregistrer la recherche", None
|
||||
|
||||
|
||||
|
@ -873,7 +874,7 @@ def recherche_tips_ret_ref(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "N/A"
|
||||
|
||||
|
||||
|
@ -1031,7 +1032,7 @@ def recherche_tips(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "N/A"
|
||||
|
||||
|
||||
|
@ -1111,6 +1112,6 @@ def get_stored_recherche(diction):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de recuperer les recherches du user "
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ def YTUBES_ela_index_class_transcription(external_code="", source_field = ""):
|
|||
return True
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ def YTUBES_Read_Transcritpion(transcitp_file_name = None):
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, ""
|
||||
|
||||
|
||||
|
@ -121,5 +121,5 @@ def ela_index_all_ytubes_video_transcription():
|
|||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
Loading…
Reference in New Issue