From 692c5b03692bfee1d24dcf397f18d1c490e20687 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 25 Jul 2022 07:07:45 +0200 Subject: [PATCH] API: erreurs sans abort() + fix ok:true --- app/api/formsemestres.py | 4 ++-- app/api/partitions.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/formsemestres.py b/app/api/formsemestres.py index 2e455166e..25286f5c2 100644 --- a/app/api/formsemestres.py +++ b/app/api/formsemestres.py @@ -93,7 +93,7 @@ def formsemestres_query(): try: annee_scolaire_int = int(annee_scolaire) except ValueError: - abort(404, "invalid annee_scolaire: not int") + return error_response(404, "invalid annee_scolaire: not int") debut_annee = scu.date_debut_anne_scolaire(annee_scolaire_int) fin_annee = scu.date_fin_anne_scolaire(annee_scolaire_int) formsemestres = formsemestres.filter( @@ -107,7 +107,7 @@ def formsemestres_query(): try: dept_id = int(dept_id) except ValueError: - abort(404, "invalid dept_id: not int") + return error_response(404, "invalid dept_id: not int") formsemestres = formsemestres.filter_by(dept_id=dept_id) return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres]) diff --git a/app/api/partitions.py b/app/api/partitions.py index a287aa963..886a0d82b 100644 --- a/app/api/partitions.py +++ b/app/api/partitions.py @@ -212,7 +212,7 @@ def group_delete(group_id: int): db.session.commit() app.set_sco_dept(group.partition.formsemestre.departement.acronym) sco_cache.invalidate_formsemestre(formsemestre_id) - return jsonify({"OK": 1}) + return jsonify({"OK": True}) @bp.route("/group//edit", methods=["POST"]) @@ -402,4 +402,4 @@ def partition_delete(partition_id: int): sco_cache.invalidate_formsemestre(formsemestre.id) if is_parcours: formsemestre.update_inscriptions_parcours_from_groups() - return jsonify({"OK": 1}) + return jsonify({"OK": True})