示例#1
0
 def _commit_manually(*args, **kw):
     try:
         common.enter_transaction_management()
         common.managed(True)
         return func(*args, **kw)
     finally:
         common.leave_transaction_management()
示例#2
0
 def _autocommit(*args, **kw):
     try:
         common.enter_transaction_management(managed=False)
         common.managed(False)
         return func(*args, **kw)
     finally:
         common.leave_transaction_management()
示例#3
0
 def _commit_on_success(*args, **kw):
     try:
         common.enter_transaction_management()
         common.managed(True)
         try:
             res = func(*args, **kw)
         except:
             # All exceptions must be handled here (even string ones).
             common.rollback()
             raise
         else:
             try:
                 common.commit()
             except:
                 common.rollback()
                 raise
         return res
     finally:
         common.leave_transaction_management()