Compare commits

...
+6 -5
View File
@@ -63,9 +63,10 @@ def teardown( # pylint: disable=unused-argument
:see: https://gist.github.com/twolfson/a1b329e9353f9b575131
"""
if flask_app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN"):
if not isinstance(retval, Exception):
db.session.commit() # pylint: disable=consider-using-transaction
with flask_app.app_context():
if flask_app.config.get("SQLALCHEMY_COMMIT_ON_TEARDOWN"):
if not isinstance(retval, Exception):
db.session.commit() # pylint: disable=consider-using-transaction
if not flask_app.config.get("CELERY_ALWAYS_EAGER"):
db.session.remove()
if not flask_app.config.get("CELERY_ALWAYS_EAGER"):
db.session.remove()