From 8e9f8e4e7e87ee03b179c52f7aed9c13dd367539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ch=C3=A9rifBALDE?= Date: Sun, 20 Feb 2022 21:09:05 +0100 Subject: [PATCH] Validation 19/02/22 - 21h00 --- class_mgt.py | 11 ++++++++--- main.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/class_mgt.py b/class_mgt.py index ccbeb7c..d509cfe 100644 --- a/class_mgt.py +++ b/class_mgt.py @@ -44,11 +44,11 @@ def add_class(diction): # field_list. ''' field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel', - 'price', 'url','duree_formation','token', 'plus_produit', 'mots_cle'] + 'price', 'url','duree_formation','token', 'plus_produit', 'mots_cle','domaine'] incom_keys = diction.keys() for val in incom_keys: if val not in field_list: - mycommon.myprint(str(inspect.stack()[0][3])+" - Creation formation : Le champ '" + val + "' n'existe pas, Creation formation annulée") + mycommon.myprint(str(inspect.stack()[0][3])+" - Creation formation : Le champ '" + val + "' n'est pas autorisé, Creation formation annulée") return False, " Verifier votre API" ''' @@ -154,6 +154,11 @@ def add_class(diction): mydata['mots_cle'] = diction['mots_cle'] + if ("domaine" in diction.keys()): + if diction['domaine']: + mydata['domaine'] = diction['domaine'] + + mydata['valide'] = '1' mydata['locked'] = '0' mydata['indexed'] = '0' @@ -843,7 +848,7 @@ def get_class(diction): filt_title = {'title': {'$regex': str(diction['title'])}} - + print(" ATTTTENNTION : GESTION DU CAS OU LA PERSONNE QUI CHERCHE LE COURS EST UN UTILISATEUR : PB avec : partner_owner_recid ") print(" #### avant requete get partner_owner_recid ="+str(user_recid)+ " filt_external_code = "+str(filt_external_code)+ " filt_title = "+str(filt_title)) diff --git a/main.py b/main.py index cda70ae..023803e 100644 --- a/main.py +++ b/main.py @@ -214,7 +214,7 @@ def update_user_account(): return jsonify(status=status, message=retval) -@app.route('/myclass/api/create_class/', methods=['POST']) +@app.route('/myclass/api/create_class/', methods=['POST','GET']) @crossdomain(origin='*') def create_class(): # On recupere le corps (payload) de la requete