コード例 #1
0
ファイル: cpulse.py プロジェクト: kirubajohn/cloudpulse
    def get(cls, context, test_id):
        """Find a test based on its id or uuid and return a Cpulse object.

        :param test_id: the id *or* uuid of a test.
        :returns: a :class:`Cpulse` object.
        """
        if utils.is_int_like(test_id):
            return cls.get_by_id(context, test_id)
        elif utils.is_uuid_like(test_id):
            return cls.get_by_uuid(context, test_id)
        else:
            raise exception.InvalidIdentity(identity=test_id)
コード例 #2
0
ファイル: cpulse.py プロジェクト: pradeepcsekar/cloudpulse
    def get(cls, context, test_id):
        """Find a test based on its id or uuid and return a Cpulse object.

        :param test_id: the id *or* uuid of a test.
        :returns: a :class:`Cpulse` object.
        """
        if utils.is_int_like(test_id):
            return cls.get_by_id(context, test_id)
        elif utils.is_uuid_like(test_id):
            return cls.get_by_uuid(context, test_id)
        else:
            raise exception.InvalidIdentity(identity=test_id)
コード例 #3
0
ファイル: api.py プロジェクト: anand1712/cloudpulse
def add_identity_filter(query, value):
    """Adds an identity filter to a query.

    Filters results by ID, if supplied value is a valid integer.
    Otherwise attempts to filter results by UUID.

    :param query: Initial query to add filter to.
    :param value: Value for filtering results by.
    :return: Modified query.
    """
    if utils.is_int_like(value):
        return query.filter_by(id=value)
    elif utils.is_uuid_like(value):
        return query.filter_by(uuid=value)
    else:
        raise exception.InvalidIdentity(identity=value)
コード例 #4
0
ファイル: api.py プロジェクト: schoksey/cloudpulse
def add_identity_filter(query, value):
    """Adds an identity filter to a query.

    Filters results by ID, if supplied value is a valid integer.
    Otherwise attempts to filter results by UUID.

    :param query: Initial query to add filter to.
    :param value: Value for filtering results by.
    :return: Modified query.
    """
    if utils.is_int_like(value):
        return query.filter_by(id=value)
    elif utils.is_uuid_like(value):
        return query.filter_by(uuid=value)
    else:
        raise exception.InvalidIdentity(identity=value)