def enter_transaction_management(managed=True, using=None):
 if (using is None):
  using = DEFAULT_DB_ALIAS
 connection = connections[using]
 thread_ident = thread.get_ident()
 if ((thread_ident in state) and state[thread_ident].get(using)):
  state[thread_ident][using].append(state[thread_ident][using][(-1)])
 else:
  state.setdefault(thread_ident, {})
  state[thread_ident][using] = [settings.TRANSACTIONS_MANAGED]
 if ((thread_ident not in dirty) or (using not in dirty[thread_ident])):
  dirty.setdefault(thread_ident, {})
  dirty[thread_ident][using] = False
 connection._enter_transaction_management(managed)

def enter_transaction_management ( managed = True , using = None ) : if ( using is None ) : using = DEFAULT_DB_ALIAS connection = connections [ using ] thread_ident = thread . get_ident ( ) if ( ( thread_ident in state ) and state [ thread_ident ] . get ( using ) ) : state [ thread_ident ] [ using ] . append ( state [ thread_ident ] [ using ] [ ( - 1 ) ] ) else : state . setdefault ( thread_ident , { } ) state [ thread_ident ] [ using ] = [ settings . TRANSACTIONS_MANAGED ] if ( ( thread_ident not in dirty ) or ( using not in dirty [ thread_ident ] ) ) : dirty . setdefault ( thread_ident , { } ) dirty [ thread_ident ] [ using ] = False connection . _enter_transaction_management ( managed )
enters transaction management for a running thread .