def parse(self, dispatcher, model_handler):

        for arg in dispatcher.request.arguments():
            if(arg == QUERY_OFFSET_PARAM):
                query_offset = str(dispatcher.request.get(QUERY_OFFSET_PARAM))
                if query_offset[0:2] == QUERY_CURSOR_PREFIX:
                    self.fetch_cursor = query_offset[2:]
                else:
                    self.fetch_offset = int(query_offset)
                continue

            if(arg == QUERY_PAGE_SIZE_PARAM):
                self.fetch_page_size = int(
                    dispatcher.request.get(QUERY_PAGE_SIZE_PARAM))
                continue

            if(arg == QUERY_ORDERING_PARAM):
                ordering_field = dispatcher.request.get(QUERY_ORDERING_PARAM)
                if(ordering_field[0] == "-"):
                    ordering_field = ordering_field[1:]
                    self.order_type_idx = QUERY_ORDER_DSC_IDX
                prop_handler = model_handler.get_property_handler(
                    ordering_field)
                if(not prop_handler.can_query()):
                    raise KeyError("Can not order on property %s" %
                                   ordering_field)
                self.ordering = prop_handler.get_query_field()
                continue

            if(arg in EXTRA_QUERY_PARAMS):
                #ignore
                continue

            match = QUERY_TERM_PATTERN.match(arg)
            if(match is None):
                logging.warning("ignoring unexpected query param %s", arg)
                continue

            query_type = match.group(1)
            query_field = match.group(2)
            query_sub_expr = QUERY_EXPRS[query_type]

            query_values = dispatcher.request.get_all(arg)
            if(query_type == QUERY_LIST_TYPE):
                query_values = [v.split(",") for v in query_values]

            query_field, query_values = model_handler.read_query_values(
                query_field, query_values)

            for value in query_values:
                self.query_params.append(value)
                query_sub_expr = query_sub_expr % (query_field,
                                                   len(self.query_params))
                if(not self.query_expr):
                    self.query_expr = QUERY_PREFIX + query_sub_expr
                else:
                    self.query_expr += QUERY_JOIN + query_sub_expr

        self.fetch_page_size = max(min(dispatcher.fetch_page_size,
                                       self.fetch_page_size,
                                       MAX_FETCH_PAGE_SIZE), 1)
Parses the current request into a query.
dataset/ETHPy150Open jahlborn/appengine-rest-server/src/main/python/rest/__init__.py/ModelQuery.parse