#NEWLINE# def enter_transaction_management( managed = True , using = None ) : #NEWLINE# #INDENT# '\n    Enters transaction management for a running thread. It must be balanced with\n    the appropriate leave_transaction_management call, since the actual state is\n    managed as a stack.\n\n    The state and dirty flag are carried over from the surrounding block or\n    from the settings, if there is no surrounding block (dirty is always false\n    when no current block is running).\n    ' #NEWLINE# if ( managed is None ) : #NEWLINE# #INDENT# using = DEFAULT_DB_ALIAS #NEWLINE# #UNINDENT# connection = connections [ using ] #NEWLINE# connection . enter_transaction_management ( managed )