def get_sort_limit(): """ returns the 'sort_limit' from the request """ limit = _.convert(get("sort_limit"), _.to_int) if (limit < 1): limit = None # catalog raises IndexError if limit < 1 return limit
def get_request_data(): """ extract and convert the json data from the request returns a list of dictionaries """ request = get_request() data = request.get("BODY", "{}") if not is_json_deserializable(data): from plone.jsonapi.routes.exceptions import APIError raise APIError( 400, "Request Data is not JSON deserializable – Check JSON Syntax!") return _.convert(json.loads(data), _.to_list)
def get_depth(): """ returns the 'depth' from the request """ return _.convert(get("depth", 0), _.to_int)
def get_batch_start(): """ returns the 'start' from the request """ return _.convert(get("b_start"), _.to_int) or 0
def get_batch_size(): """ returns the 'limit' from the request """ return _.convert(get("limit"), _.to_int) or 25