def get_request_data(request): """ extract and convert the json data from the request >>> request = dict(BODY="{}") >>> get_request_data(request) [{}] """ return _.convert(json.loads(request.get("BODY", {})), _.to_list)
def get_sort_limit(request): """ returns the 'sort_limit' from the request """ limit = _.convert(request.form.get("limit"), _.to_int) if (limit < 1): limit = None # catalog raises IndexError if limit < 1 return limit
def get_start(request): """ returns the 'start' from the request """ return _.convert(request.form.get("start"), _.to_int)