This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def db_transaction(flush=False): | |
""" | |
Takes care of rolling back, committing and closing | |
session for decorated function. | |
""" | |
def wrap(f): | |
def wrapped_f(*args, **kwargs): | |
session = kwargs.get('session') | |
try: | |
result = f(*args, **kwargs) |