Make update notification status transcational.

Refactor methods for reusability.
This commit is contained in:
Rebecca Law
2016-05-27 12:09:36 +01:00
parent 25a1b7f31c
commit 885abcaf16
4 changed files with 30 additions and 27 deletions

View File

@@ -9,8 +9,9 @@ def transactional(func):
from flask import current_app
from app import db
try:
func(*args, **kwargs)
res = func(*args, **kwargs)
db.session.commit()
return res
except Exception as e:
current_app.logger.error(e)
db.session.rollback()