10/04/23 - 15h

master
cherif 2023-04-10 15:41:03 +02:00
parent 3de09a2030
commit 74371be42a
7 changed files with 2079 additions and 10 deletions

View File

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" />
</component>
</project>

View File

@ -1,10 +1,14 @@
<?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="07/04/23 - 9h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="07/04/23 - 11h">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Attestation_Certificat.py" beforeDir="false" afterPath="$PROJECT_DIR$/Attestation_Certificat.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/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$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -75,7 +79,14 @@
<option name="project" value="LOCAL" />
<updated>1680853542130</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="07/04/23 - 11h">
<created>1680858757338</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1680858757338</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -91,6 +102,7 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="07/04/23 - 9h" />
<option name="LAST_COMMIT_MESSAGE" value="07/04/23 - 9h" />
<MESSAGE value="07/04/23 - 11h" />
<option name="LAST_COMMIT_MESSAGE" value="07/04/23 - 11h" />
</component>
</project>

View File

@ -103,6 +103,7 @@ def GetSpecificPartnerAttestation_Certificat(diction):
RetObject = []
ret_val = MYSY_GV.dbname['attestation_certificat'].find_one({"nom":str(diction['nom']), "valide":"1" })
if( ret_val is None):
mycommon.myprint(
str(inspect.stack()[0][
@ -110,7 +111,7 @@ def GetSpecificPartnerAttestation_Certificat(diction):
return False, "Impossible de recuperer les données de ce template"
if ("preview_url" not in diction.keys()):
if ("preview_url" not in ret_val.keys()):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Cette session n'a pas de 'preview_url' sur le modele d'attestation ")

View File

@ -49,7 +49,7 @@ def AddStagiairetoClass(diction):
'''
field_list = ['nom', 'prenom', 'email', 'telephone', 'modefinancement', 'opco',
'class_internal_url', 'session_id', 'employeur', 'status', 'price',
'inscription_validation_date']
'inscription_validation_date', 'token']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list:

File diff suppressed because it is too large Load Diff

18
main.py
View File

@ -2383,16 +2383,28 @@ def mysylmsdb():
"""
API de test de fonctionnement du webservice
"""
@app.route('/myclass/api/test_web_service/', methods=['POST','GET'])
@app.route('/myclass/api/test_web_service/<token>/<invoiceid>', methods=['POST','GET'])
@crossdomain(origin='*')
def test_web_service():
def test_web_service(invoiceid, token):
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### test_web_service : payload = ",payload)
payload = {}
payload['token'] = str(token)
payload['invoiceid'] = str(invoiceid)
print(" ### payload facture = ", str(invoiceid), " token = ",str(token))
localStatus, message= tools_cherif.test_web_service(payload)
return jsonify(status=localStatus, message=message )
@app.route('/myclass/api/test_web_service2/', methods=['POST','GET'])
@crossdomain(origin='*')
def test_web_service2():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### email_validation : payload = ", payload)
localStatus, message = tools_cherif.test_web_service2(payload)
return jsonify(status=localStatus, message=message)
"""
Cette API créer un user LMS Mysy, c'est a dire un user chamilo

View File

@ -795,7 +795,25 @@ def mysylmsdb():
def test_web_service(diction):
try:
if( diction ):
print(" ### diction = ", diction)
print(" ### diction dans la fonction = ", diction)
else:
print(" ### diction dans la fonction est vide")
return True, "Test WebService OK Diction = "+str(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, "Test WebService KOOO"
def test_web_service2(diction):
try:
if( diction ):
print(" ### diction dans la fonction = ", diction)
else:
print(" ### diction dans la fonction est vide")
return True, "Test WebService OK Diction = "+str(diction)