def in_transaction ( self ) : if not hasattr ( self . local , 'tx' ) : return False return len ( self . local . tx ) > 0
python this transaction is inactive
Check if this database is in a transactional context .
def in_transaction(self):
        """Check if this database is in a transactional context."""
        if not hasattr(self.local, 'tx'):
            return False
        return len(self.local.tx) > 0