cyborg/db/sqlalchemy/api.py
def _exact_deployable_filter_with_attributes(self, query,
                                                 dpl_filters, legal_keys,
                                                 attribute_filters):
        """Applies exact match filtering to a deployable query.
        Returns the updated query.  Modifies dpl_filters argument to remove
        dpl_filters consumed.
        :param query: query to apply dpl_filters and attribute_filters to
        :param dpl_filters: dictionary of filters; values that are lists,
                        tuples, sets, or frozensets cause an 'IN' test to
                        be performed, while exact matching ('==' operator)
                        is used for other values
        :param legal_keys: list of keys to apply exact filtering to
        :param attribute_filters: dictionary of attribute filters
        """

        filter_dict = {}
        model = models.Deployable

        # Walk through all the keys
        for key in legal_keys:
            # Skip ones we're not filtering on
            if key not in dpl_filters:
                continue

            # OK, filtering on this key; what value do we search for?
            value = dpl_filters.pop(key)

            if isinstance(value, (list, tuple, set, frozenset)):
                if not value:
                    return None
                # Looking for values in a list; apply to query directly
                column_attr = getattr(model, key)
                query = query.filter(column_attr.in_(value))
            else:
                filter_dict[key] = value
        # Apply simple exact matches
        if filter_dict:
            query = query.filter(*[getattr(models.Deployable, k) == v
                                   for k, v in filter_dict.items()])
        if attribute_filters:
            query = query.outerjoin(models.Attribute)
            query = query.filter(or_(*[and_(models.Attribute.key == k,
                                 models.Attribute.value == v)
                                 for k, v in attribute_filters.items()]))
        return query
Applies exact match filtering to a deployable query.
        Returns the updated query.  Modifies dpl_filters argument to remove
        dpl_filters consumed.
        :param query: query to apply dpl_filters and attribute_filters to
        :param dpl_filters: dictionary of filters; values that are lists,
                        tuples, sets, or frozensets cause an 'IN' test to
                        be performed, while exact matching ('==' operator)
                        is used for other values
        :param legal_keys: list of keys to apply exact filtering to
        :param attribute_filters: dictionary of attribute filters
        
Applies exact match filtering to a deployable query.
Returns the updated query.  Modifies dpl_filters argument to remove
dpl_filters consumed.
Applies exact match filtering to a deployable query . Returns the updated query . Modifies dpl_filters argument to remove dpl_filters consumed .
def _exact_deployable_filter_with_attributes(self, query,
                                                 dpl_filters, legal_keys,
                                                 attribute_filters):
        filter_dict = {}
        model = models.Deployable
        for key in legal_keys:
            if key not in dpl_filters:
                continue
            value = dpl_filters.pop(key)
            if isinstance(value, (list, tuple, set, frozenset)):
                if not value:
                    return None
                column_attr = getattr(model, key)
                query = query.filter(column_attr.in_(value))
            else:
                filter_dict[key] = value
        if filter_dict:
            query = query.filter(*[getattr(models.Deployable, k) == v
                                   for k, v in filter_dict.items()])
        if attribute_filters:
            query = query.outerjoin(models.Attribute)
            query = query.filter(or_(*[and_(models.Attribute.key == k,
                                 models.Attribute.value == v)
                                 for k, v in attribute_filters.items()]))
        return query
def _exact_deployable_filter_with_attributes ( self , query , dpl_filters , legal_keys , attribute_filters ) : filter_dict = { } model = models . Deployable for key in legal_keys : if key not in dpl_filters : continue value = dpl_filters . pop ( key ) if isinstance ( value , ( list , tuple , set , frozenset ) ) : if not value : return None column_attr = getattr ( model , key ) query = query . filter ( column_attr . in_ ( value ) ) else : filter_dict [ key ] = value if filter_dict : query = query . filter ( * [ getattr ( models . Deployable , k ) == v for k , v in filter_dict . items ( ) ] ) if attribute_filters : query = query . outerjoin ( models . Attribute ) query = query . filter ( or_ ( * [ and_ ( models . Attribute . key == k , models . Attribute . value == v ) for k , v in attribute_filters . items ( ) ] ) ) return query
Applies exact match filtering to a deployable query.
Applies exact match filtering to a deployable query .
"""Applies exact match filtering to a deployable query.
        Returns the updated query.  Modifies dpl_filters argument to remove
        dpl_filters consumed.
        :param query: query to apply dpl_filters and attribute_filters to
        :param dpl_filters: dictionary of filters; values that are lists,
                        tuples, sets, or frozensets cause an 'IN' test to
                        be performed, while exact matching ('==' operator)
                        is used for other values
        :param legal_keys: list of keys to apply exact filtering to
        :param attribute_filters: dictionary of attribute filters
        """ # Walk through all the keys # Skip ones we're not filtering on # OK, filtering on this key; what value do we search for? # Looking for values in a list; apply to query directly # Apply simple exact matches
self
query
query to apply dpl_filters and attribute_filters to
query to apply dpl_filters and attribute_filters to
dpl_filters
dictionary of filters; values that are lists,
tuples, sets, or frozensets cause an 'IN' test to
be performed, while exact matching ('==' operator)
is used for other values
dictionary of filters ; values that are lists tuples sets or frozensets cause an ' IN ' test to be performed while exact matching ( ' == ' operator ) is used for other values
legal_keys
list of keys to apply exact filtering to
list of keys to apply exact filtering to
attribute_filters
dictionary of attribute filters
dictionary of attribute filters