From 0a5919b7884b975af7f0c14fcfb64028dfe5ace3 Mon Sep 17 00:00:00 2001 From: Iziram Date: Mon, 22 Apr 2024 09:20:05 +0200 Subject: [PATCH] =?UTF-8?q?Assiduit=C3=A9=20:=20pseudo-fix=20(catch=20+=20?= =?UTF-8?q?http=20error)=20#872?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/assiduites.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/api/assiduites.py b/app/api/assiduites.py index d44e0c6b..3f3aee5d 100644 --- a/app/api/assiduites.py +++ b/app/api/assiduites.py @@ -3,14 +3,15 @@ # Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved. # See LICENSE ############################################################################## -"""ScoDoc 9 API : Assiduités -""" +"""ScoDoc 9 API : Assiduités""" + from datetime import datetime from flask import g, request from flask_json import as_json from flask_login import current_user, login_required from flask_sqlalchemy.query import Query +from sqlalchemy.orm.exc import ObjectDeletedError from app import db, log, set_sco_dept import app.scodoc.sco_assiduites as scass @@ -858,7 +859,10 @@ def assiduite_edit(assiduite_id: int): msg=f"assiduite: modif {assiduite_unique}", ) db.session.commit() - scass.simple_invalidate_cache(assiduite_unique.to_dict()) + try: + scass.simple_invalidate_cache(assiduite_unique.to_dict()) + except ObjectDeletedError: + return json_error(404, "Assiduité supprimée / inexistante") return {"OK": True}