Continue Flask migration.
This commit is contained in:
parent
4e8a616b23
commit
2c747d75e4
@ -201,13 +201,16 @@ class Set_mode_thermostat(Resource):
|
|||||||
return "OK", 201
|
return "OK", 201
|
||||||
except sqlalchemy.exc.IntegrityError as e:
|
except sqlalchemy.exc.IntegrityError as e:
|
||||||
try:
|
try:
|
||||||
|
db.session.rollback()
|
||||||
cur_mode = db.session.execute(db.select(Set_mode).filter_by(name="mode")).scalar_one()
|
cur_mode = db.session.execute(db.select(Set_mode).filter_by(name="mode")).scalar_one()
|
||||||
cur_mode = data
|
cur_mode = data
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
db.session.rollback()
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
return "K0", 400
|
return "K0", 400
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
db.session.rollback()
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
return "K0", 400
|
return "K0", 400
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user