mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
This approach uses part of sqlalchemy example history_meta code
adapted to recording inserts and updates. This removes need to manually create history tables. Our code still remains in control of when history records are created.
This commit is contained in:
@@ -30,22 +30,7 @@ from app.clients import (
|
||||
STATISTICS_REQUESTED
|
||||
)
|
||||
|
||||
from functools import wraps
|
||||
|
||||
|
||||
def transactional(func):
|
||||
@wraps(func)
|
||||
def commit_or_rollback(*args, **kwargs):
|
||||
from flask import current_app
|
||||
from app import db
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
db.session.commit()
|
||||
except Exception as e:
|
||||
current_app.logger.error(e)
|
||||
db.session.rollback()
|
||||
raise
|
||||
return commit_or_rollback
|
||||
from app.dao.dao_utils import transactional
|
||||
|
||||
|
||||
def get_character_count_of_content(content, encoding='utf-8'):
|
||||
|
||||
Reference in New Issue
Block a user