'Puts the transaction manager into a manual state: managed transactions have
to be committed explicitly by the user. If you switch off transaction
management and there is a pending commit/rollback, the data will be
commited.'

def managed(self, flag=True):

    top = self.transaction_state
    if top:
        top[(-1)] = flag
        if ((not flag) and self.is_dirty()):
            self._commit()
            self.set_clean()
    else:
        raise TransactionManagementError("This    code    isn't    under    transaction    management")
