Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Returns a new :class:`SearchParameters` object with arguments parsed
from `dictionary`.

`dictionary` is a dictionary of the form::

    {
      'filters': [{'name': 'age', 'op': 'lt', 'val': 20}, ...],
      'order_by': [{'field': 'age', 'direction': 'desc'}, ...]
      'limit': 10,
      'offset': 3,(more...)

            @staticmethod
    def from_dictionary(dictionary):
        """Returns a new :class:`SearchParameters` object with arguments parsed
        from `dictionary`.

        `dictionary` is a dictionary of the form::

            {
              'filters': [{'name': 'age', 'op': 'lt', 'val': 20}, ...],
              'order_by': [{'field': 'age', 'direction': 'desc'}, ...]
              'limit': 10,
              'offset': 3,
              'disjunction': True
            }

        where ``dictionary['filters']`` is the list of :class:`Filter` objects
        (in dictionary form), ``dictionary['order_by']`` is the list of
        :class:`OrderBy` objects (in dictionary form), ``dictionary['limit']``
        is the maximum number of matching entries to return,
        ``dictionary['offset']`` is the number of initial entries to skip in
        the matching result set, and ``dictionary['disjunction']`` is whether
        the filters should be joined as a disjunction or conjunction.

        The provided dictionary may have other key/value pairs, but they are
        ignored.

        """
        # for the sake of brevity...
        from_dict = Filter.from_dictionary
        filters = [from_dict(f) for f in dictionary.get('filters', [])]
        order_by_list = dictionary.get('order_by', [])
        order_by = [OrderBy(**o) for o in order_by_list]
        limit = dictionary.get('limit')
        offset = dictionary.get('offset')
        disjunction = dictionary.get('disjunction')
        junction = OR if disjunction else AND
        return SearchParameters(filters=filters, limit=limit, offset=offset,
                                order_by=order_by, junction=junction)
        


src/f/l/flask-restless-HEAD/tests/test_search.py   flask-restless(Download)
        """
        d = {'filters': [{'name': 'name', 'val': u'%y%', 'op': 'like'}]}
        s = SearchParameters.from_dictionary(d)
        query_d = create_query(self.session, self.Person, d)
        query_s = create_query(self.session, self.Person, s)