21/05/23 - 22h
parent
1e2545013c
commit
4af87856da
|
@ -1,17 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/05/23 - 23h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/05/23 - 10h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -222,7 +220,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1684182658305</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="23" />
|
||||
<task id="LOCAL-00023" summary="21/05/23 - 10h">
|
||||
<created>1684655964597</created>
|
||||
<option name="number" value="00023" />
|
||||
<option name="presentableId" value="LOCAL-00023" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1684655964597</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="24" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -256,6 +261,7 @@
|
|||
<MESSAGE value="13/05/23 - 17h" />
|
||||
<MESSAGE value="13/05/23 - 23h" />
|
||||
<MESSAGE value="15/05/23 - 23h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="15/05/23 - 23h" />
|
||||
<MESSAGE value="21/05/23 - 10h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="21/05/23 - 10h" />
|
||||
</component>
|
||||
</project>
|
|
@ -77,10 +77,10 @@ token_fr_pontuation = []
|
|||
La taille maximal d'un champs à retourner.
|
||||
Au dela de 300 caractère, le système rame
|
||||
'''
|
||||
MAX_CARACT = 400
|
||||
MAX_CARACT = 500
|
||||
MAX_CARACT_DEDUIT = 150
|
||||
TOKEN_SIZE = 25
|
||||
MAX_CARACT_DETAIL = 10000
|
||||
MAX_CARACT_DETAIL = 600
|
||||
|
||||
|
||||
|
||||
|
|
1792
Log/log_file.log
1792
Log/log_file.log
File diff suppressed because it is too large
Load Diff
135
class_mgt.py
135
class_mgt.py
|
@ -410,132 +410,6 @@ def add_class(diction):
|
|||
mydata['zone_diffusion'] = {'country':tab_country, 'city':tab_city}
|
||||
|
||||
|
||||
'''
|
||||
Traitement date_lieu.
|
||||
Date_lieu definit une session et au format :
|
||||
date_du;data_au;ville;code_postal; adresse
|
||||
|
||||
mydata['datelieu'] = ""
|
||||
|
||||
if ("date_lieu" in diction.keys()):
|
||||
if diction['date_lieu'] and len(str(diction['date_lieu'])) > 0 :
|
||||
tmp_str2 = str(diction['date_lieu']).lower().replace(",", ";").replace("\r\n", "")
|
||||
|
||||
print(" ### tmp_str2 = "+str(tmp_str2))
|
||||
|
||||
if (not tmp_str2.endswith(";")):
|
||||
tmp_str2 = tmp_str2 + ";"
|
||||
|
||||
# print("tmp_str2 = " + tmp_str2)
|
||||
|
||||
if (";" not in tmp_str2):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - les dates et lieux de la formation : " + str(
|
||||
diction['external_code']) + " sont incorrectes 1")
|
||||
return False, "Les Dates et Lieux de la formation " + str(
|
||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse"
|
||||
|
||||
tmp_str = tmp_str2.split(
|
||||
";") # ==> ce qui va donner un tableau de : Country_Code-City : ['11/02/2012-paris-75001', '24/04/2022-marseille-13002',]
|
||||
|
||||
i = 0
|
||||
for tmp_val in tmp_str:
|
||||
tmp_str[i] = str(tmp_str[i]).strip()
|
||||
i = i +1
|
||||
|
||||
dl_cpt = 0
|
||||
tab_dl = []
|
||||
for tmp_dl in tmp_str:
|
||||
#print(" ##### tmp_dl = "+str(tmp_dl))
|
||||
if (len(str(tmp_dl)) > 0 and ("-" in tmp_dl)):
|
||||
#print(" ###### DATE LIEU = "+str(tmp_dl))
|
||||
tab_date_lieu = tmp_dl.split('-')
|
||||
if (len(tab_date_lieu) != 5):
|
||||
return False, "Les Dates et Lieux de la formation " + str(
|
||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse"
|
||||
|
||||
isdate = mycommon.CheckisDate(str(tab_date_lieu[0]))
|
||||
if (isdate is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - les dates et lieux de la formation : A" + str(
|
||||
diction['external_code']) + " sont incorrectes 2")
|
||||
return False, "Les Dates et Lieux de la formation " + str(
|
||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse 3"
|
||||
|
||||
isdate_au = mycommon.CheckisDate(str(tab_date_lieu[1]))
|
||||
if (isdate is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - les dates et lieux de la formation : A" + str(
|
||||
diction['external_code']) + " sont incorrectes 3")
|
||||
return False, "Les Dates et Lieux de la formation " + str(
|
||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse 2"
|
||||
|
||||
#print("### isdate = '" + str(tab_date_lieu[0]) + "' CM isdate_au = '" + str(tab_date_lieu[1])+"' ")
|
||||
|
||||
|
||||
if (datetime.strptime(str(tab_date_lieu[0]).strip(), '%d/%m/%Y') > datetime.strptime(
|
||||
str(tab_date_lieu[1]).strip(), '%d/%m/%Y')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - la date debut est postérieur à la date de fin pour la formation : " + str(
|
||||
diction['external_code']) + " ")
|
||||
return False, " La date debut est postérieur à la date de fin pour la formation : " + str(
|
||||
diction['external_code']) + " "
|
||||
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
if (datetime.strptime(str(tab_date_lieu[0]).strip(), '%d/%m/%Y') < datetime.strptime(str(mytoday).strip(),
|
||||
'%d/%m/%Y')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - la date debut est postérieur à la date du jour pour la formation : " + str(
|
||||
diction['external_code']) + " ")
|
||||
return False, " La date debut est postérieur à la date du jour pour la formation : " + str(
|
||||
diction['external_code']) + " "
|
||||
|
||||
# On créé un identifiant unique par session
|
||||
#session_id = mycommon.create_token_urlsafe()
|
||||
"""
|
||||
On créé un identifiant unique par session
|
||||
Session_id = date_du+date_au+code_postal+adresse
|
||||
"""
|
||||
|
||||
session_id = str(str(tab_date_lieu[0]) + str(tab_date_lieu[1]) + str(tab_date_lieu[3]) + str(
|
||||
tab_date_lieu[4])).replace(' ', '')
|
||||
session_id = mycommon.remove_non_ascii(session_id)
|
||||
session_id = re.sub(r'[^a-zA-Z0-9]', '', session_id)
|
||||
|
||||
## Verifier si le CP n'est composé que de "0", au quel cas il s'agit d'une formation en ligne.
|
||||
local_cp = str(tab_date_lieu[3]).replace("0", "").strip()
|
||||
class_cp = ""
|
||||
if (local_cp == ""):
|
||||
class_cp = "0"
|
||||
else:
|
||||
class_cp = str(tab_date_lieu[3]).strip()
|
||||
|
||||
|
||||
val_dl = {'date_du': str(tab_date_lieu[0]).strip(), 'date_au': str(tab_date_lieu[1]).strip(),
|
||||
'ville': str(tab_date_lieu[2]).strip(), 'code_postal': str(class_cp).strip(),
|
||||
'adresse': str(tab_date_lieu[4]).strip(), 'session_id': str(session_id).strip()}
|
||||
|
||||
|
||||
tab_dl.append(val_dl)
|
||||
# mydata['date_lieu'][dl_cpt] = {'date': str(tab_date_lieu[0]), 'ville': str(tab_date_lieu[1])}
|
||||
# print(str(mydata['date_lieu'] ))
|
||||
# print(" ######### date_lieu = " + str(tab_date_lieu[0]) + " ----- " + str(tab_date_lieu[1]))
|
||||
|
||||
dl_cpt = dl_cpt + 1
|
||||
|
||||
elif (len(str(tmp_dl)) > 0 and ("-" not in tmp_dl)):
|
||||
return False, "Les Dates et Lieux de la formation " + str(
|
||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse 1"
|
||||
|
||||
mydata['datelieu'] = tab_dl
|
||||
'''
|
||||
|
||||
mydata['valide'] = '1'
|
||||
mydata['locked'] = '0'
|
||||
mydata['indexed'] = '0'
|
||||
|
@ -594,6 +468,7 @@ def add_class(diction):
|
|||
return False, "la formation avec l'external code " + str(mydata['external_code']) + "' existe deja. Impossible de créer la formation "
|
||||
'''
|
||||
|
||||
#print(" ### Add_Class mydata = ", mydata)
|
||||
#coll_name.insert_one(mydata)
|
||||
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
|
@ -1087,6 +962,8 @@ def update_class(diction):
|
|||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
#print(" ### Update class : internal_url = ", str(my_internal_url), " -- partner_owner_recid = ", partner_recid)
|
||||
#print(" ### mydata = ", mydata)
|
||||
|
||||
# seules les formation avec locked = 0 et valide=1 sont modifiables
|
||||
ret_val = coll_name.find_one_and_update({'internal_url': str(my_internal_url), 'partner_owner_recid':partner_recid, 'locked': '0', 'valide': '1'},
|
||||
|
@ -1872,16 +1749,14 @@ def get_class(diction):
|
|||
if( tmp_class_data is None or tmp_class_data["partner_owner_recid"] is None):
|
||||
print(' ### tmp_class_data =', str(tmp_class_data ))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire - laa ")
|
||||
return False, " impossible de recuperer les données du partenaire "
|
||||
return False, " Cette formation est indisponible "
|
||||
|
||||
tmp_partenaire_data = MYSY_GV.dbname['partnair_account'].find_one({'active':'1','locked':'0','recid':str(tmp_class_data["partner_owner_recid"]), },
|
||||
)
|
||||
|
||||
if (tmp_partenaire_data is None or tmp_partenaire_data["_id"] is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire (2) ")
|
||||
return False, " impossible de recuperer les données du partenaire (2) "
|
||||
|
||||
|
||||
return False, " Cette formation est indisponible (2) "
|
||||
|
||||
|
||||
filt_title = {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
,index,mots,occurence,moyenne,id_formation,source_field
|
||||
0,0,sql,1,0.33,MYSY_Demo_001,keyword
|
||||
1,1,bdd,1,0.33,MYSY_Demo_001,keyword
|
||||
2,2,relationnel,1,0.33,MYSY_Demo_001,keyword
|
||||
0,0,relationnel,1,0.33,MYSY_Demo_001,keyword
|
||||
1,1,sql,1,0.33,MYSY_Demo_001,keyword
|
||||
2,2,bdd,1,0.33,MYSY_Demo_001,keyword
|
||||
|
|
|
|
@ -1,4 +1,4 @@
|
|||
mots occurence moyenne id_formation source_field
|
||||
0 sql 1 0.33 MYSY_Demo_001 keyword
|
||||
1 bdd 1 0.33 MYSY_Demo_001 keyword
|
||||
2 relationnel 1 0.33 MYSY_Demo_001 keyword
|
||||
0 relationnel 1 0.33 MYSY_Demo_001 keyword
|
||||
1 sql 1 0.33 MYSY_Demo_001 keyword
|
||||
2 bdd 1 0.33 MYSY_Demo_001 keyword
|
|
@ -2929,7 +2929,8 @@ def Create_Class_From_Lms(diction):
|
|||
new_diction['certif'] = "0"
|
||||
new_diction['cpf'] = "0"
|
||||
new_diction['note'] = "4"
|
||||
new_diction['price'] = 0
|
||||
new_diction['price'] = "0"
|
||||
|
||||
|
||||
|
||||
class_internal_url = ""
|
||||
|
@ -2981,7 +2982,7 @@ def Create_Class_From_Lms(diction):
|
|||
"""
|
||||
local_class_internal_url_full = str(MYSY_GV.CLIENT_URL_BASE)+str("Display-Detail-formation/")+str(new_diction['internal_url'])
|
||||
|
||||
my_query_local_class_internal_url = "UPDATE course SET full_internal_url = '" + str(local_class_internal_url_full) + "' , " \
|
||||
my_query_local_class_internal_url = "UPDATE course SET full_internal_url = '" + str(local_class_internal_url_full) + "' , mysy_search_published = '1'," \
|
||||
" internal_url = '" + str(new_diction['internal_url']) + "' " \
|
||||
" WHERE id= '"+ str(lms_class_id)+"' "
|
||||
print(" ### my_query_local_class_internal_url = ", my_query_local_class_internal_url)
|
||||
|
@ -2996,8 +2997,6 @@ def Create_Class_From_Lms(diction):
|
|||
mycommon.myprint(" Impossible de mettre à jours la table cours avec le class_internal_url " + str({e}))
|
||||
return False, "Impossible de mettre à jour le class_internal_url" + str({e})
|
||||
|
||||
|
||||
|
||||
conn.close()
|
||||
|
||||
"""
|
||||
|
@ -3054,7 +3053,7 @@ def Create_Class_From_Lms(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))
|
||||
return False, " Impossible de créer ou mettre à jour la formation dans le moteur de recherche "
|
||||
return False, " Impossible de créer la formation dans le moteur de recherche "
|
||||
|
||||
|
||||
"""
|
||||
|
@ -3185,6 +3184,10 @@ def Update_Class_From_Lms(diction):
|
|||
if (local_class_title):
|
||||
new_diction['title'] = local_class_title
|
||||
|
||||
new_diction['distantiel'] = "1"
|
||||
new_diction['presentiel'] = "0"
|
||||
new_diction['published'] = "1"
|
||||
|
||||
|
||||
class_internal_url = ""
|
||||
|
||||
|
@ -3192,7 +3195,7 @@ def Update_Class_From_Lms(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de faire la mise à jour. Pas de valeur pour 'local_class_internal_url' ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de faire la mise à jour. Pas de valeur pour 'local_class_internal_url' ",
|
||||
|
||||
new_diction['internal_url'] = class_internal_url
|
||||
new_diction['internal_url'] = local_class_internal_url
|
||||
|
||||
if ("token" in my_partner.keys()):
|
||||
if my_partner['token']:
|
||||
|
@ -3202,7 +3205,6 @@ def Update_Class_From_Lms(diction):
|
|||
if my_partner['nom']:
|
||||
new_diction['trainer'] = my_partner['nom']
|
||||
|
||||
new_diction['source'] = "mysy_lms"
|
||||
print(" ### new_diction = ", new_diction)
|
||||
|
||||
|
||||
|
@ -3232,4 +3234,106 @@ def Update_Class_From_Lms(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))
|
||||
return False, " Impossible de créer ou mettre à jour la formation dans le moteur de recherche "
|
||||
return False, " Impossible de mettre à jour la formation dans le moteur de recherche "
|
||||
|
||||
"""
|
||||
Cette fonction permet de depublier une formation du LMS dans le Search
|
||||
"""
|
||||
def Unpublish_Class_From_Lms(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 = ['lms_mysy_recid', 'lms_class_code', 'lms_class_id']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas, mise à jour logo lms annulée")
|
||||
return False, " Les informations fournies sont incorrecte",
|
||||
|
||||
'''
|
||||
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 = ['lms_mysy_recid', 'lms_class_code','lms_class_id']
|
||||
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, " Les informations fournies sont incorrecte",
|
||||
|
||||
lms_mysy_recid = ""
|
||||
if ("lms_mysy_recid" in diction.keys()):
|
||||
if diction['lms_mysy_recid']:
|
||||
lms_mysy_recid = diction['lms_mysy_recid']
|
||||
|
||||
lms_class_code = ""
|
||||
if ("lms_class_code" in diction.keys()):
|
||||
if diction['lms_class_code']:
|
||||
lms_class_code = diction['lms_class_code']
|
||||
|
||||
lms_class_id = ""
|
||||
if ("lms_class_id" in diction.keys()):
|
||||
if diction['lms_class_id']:
|
||||
lms_class_id = diction['lms_class_id']
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(lms_mysy_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire")
|
||||
#return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire",
|
||||
|
||||
mydata = {}
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['published'] = '0'
|
||||
|
||||
ret_val = MYSY_GV.dbname['myclass'].update_many(
|
||||
{'external_code': str(lms_class_code), 'locked': '0',
|
||||
'valide': '1'}, {"$set": mydata}, )
|
||||
|
||||
if( not ret_val or ret_val is None ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Impossible de depubliée la formation au code =" + str(lms_class_code))
|
||||
return True, " Impossbile de depublier la formation au code" + str(lms_class_code) + " "
|
||||
|
||||
"""
|
||||
Recuperation des données de la formation dans le LMS
|
||||
"""
|
||||
conn = mariadb.connect(
|
||||
user=MYSY_GV.MYSY_MARIADB_USER,
|
||||
password=MYSY_GV.MYSY_MARIADB_USER_PASS,
|
||||
host=MYSY_GV.MYSY_MARIADB_HOST,
|
||||
port=MYSY_GV.MYSY_MARIADB_PORT,
|
||||
database=MYSY_GV.MYSY_LMS_BDD
|
||||
)
|
||||
|
||||
cur = conn.cursor()
|
||||
|
||||
my_query_local_class_internal_url = "UPDATE course SET mysy_search_published = '0' WHERE id = '"+ str(lms_class_id)+"' "
|
||||
print(" ### my_query_local_class_internal_url = ", my_query_local_class_internal_url)
|
||||
|
||||
|
||||
try:
|
||||
# cur.execute("INSERT INTO employees (first_name,last_name) VALUES (?, ?)", ("Maria", "DB"))
|
||||
cur.execute(my_query_local_class_internal_url)
|
||||
conn.commit()
|
||||
except mariadb.Error as e:
|
||||
# print(f"Error: {e}")
|
||||
mycommon.myprint(" Impossible de deplublier la formation " + str({e}))
|
||||
return False, "Impossible de deplublier la formation " + str({e})
|
||||
|
||||
conn.close()
|
||||
|
||||
return True, " La formation " + str(lms_class_code) + "a été depubliée"
|
||||
|
||||
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 mettre à jour la formation dans le moteur de recherche "
|
||||
|
||||
|
||||
|
||||
|
|
12
main.py
12
main.py
|
@ -2973,7 +2973,17 @@ def Update_Class_From_Lms():
|
|||
localStatus, message = mysy_lms.Update_Class_From_Lms(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
Cette API depublie une formation dans le moteur de recherche en partant du LMS
|
||||
"""
|
||||
@app.route('/myclass/api/Unpublish_Class_From_Lms/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Unpublish_Class_From_Lms():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### Unpublish_Class_From_Lms : payload = ",payload)
|
||||
localStatus, message = mysy_lms.Unpublish_Class_From_Lms(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
Loading…
Reference in New Issue