From 2c747d75e458a37756ce9f435b059933daa66e2b Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sun, 2 Jun 2024 22:20:42 +0200 Subject: [PATCH] Continue Flask migration. --- thermostat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thermostat.py b/thermostat.py index 459ca04..cc5c879 100644 --- a/thermostat.py +++ b/thermostat.py @@ -201,13 +201,16 @@ class Set_mode_thermostat(Resource): return "OK", 201 except sqlalchemy.exc.IntegrityError as e: try: + db.session.rollback() cur_mode = db.session.execute(db.select(Set_mode).filter_by(name="mode")).scalar_one() cur_mode = data db.session.commit() except Exception as e: + db.session.rollback() logging.error(e) return "K0", 400 except Exception as e: + db.session.rollback() logging.error(e) return "K0", 400