#NEWLINE# @ classmethod #NEWLINE# def _do_exit( cls , state , decorator_args , exception ) : #NEWLINE# #INDENT# independent = decorator_args . get ( 'independent' , False ) #NEWLINE# context = caching . get_context ( ) #NEWLINE# try : #NEWLINE# #INDENT# if state . transaction_started : #NEWLINE# #INDENT# if exception : #NEWLINE# #INDENT# _GetConnection ( ) . rollback ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not _GetConnection ( ) . commit ( ) ) : #NEWLINE# #INDENT# raise TransactionFailedError ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# if state . transaction_started : #NEWLINE# #INDENT# _PopConnection ( ) #NEWLINE# if exception : #NEWLINE# #INDENT# context . stack . pop ( discard = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# context . stack . pop ( apply_staged = True , clear_staged = True ) #NEWLINE# #UNINDENT# #UNINDENT# if independent : #NEWLINE# #INDENT# while independent . conn_stack : #NEWLINE# #INDENT# _PushConnection ( state . conn_stack . pop ( ) ) #NEWLINE# #UNINDENT# context . stack = state . original_stack