def commit_session(response):
"""
Try to commit the db session in the case
of a successful request with status_code
under 400.
"""
if response.status_code >= 400:
return response
try:
db_session.commit()
except DatabaseError:
db_session.rollback()
return response
评论列表
文章目录