Return list of objects of the given type.

    GET parameters:
      limit:
        number of returned objects (default 10, maximum 100)
      page:
        current page number
      filter_column:
        column name used to filter the results
      filter_value:
        value for the specified column used to filter the results
      user:
        identifier of the current user
      all:
        return all objects available instead of paging; be aware this parameter
        can be used only for objects for wich the caching is turned on
      db_orderby:
        database column which the result should be ordered by
      json_orderby:
        field of the JSON object which the result should be ordered by, it is
        less effective than the ordering via db_orderby; be aware this parameter
        can be used only for objects for which the caching is turned on
      desc
        turn on the descending order
      stats:
        turn on the enrichment of the objects by some statistics
      html
        turn on the HTML version of the API
      environment
        turn on the enrichment of the related environment values

def show_more(request, post_process_fun, get_fun, object_class, should_cache=True, template='common_json.html', to_json_kwargs=None):
    """
    Return list of objects of the given type.

    GET parameters:
      limit:
        number of returned objects (default 10, maximum 100)
      page:
        current page number
      filter_column:
        column name used to filter the results
      filter_value:
        value for the specified column used to filter the results
      user:
        identifier of the current user
      all:
        return all objects available instead of paging; be aware this parameter
        can be used only for objects for wich the caching is turned on
      db_orderby:
        database column which the result should be ordered by
      json_orderby:
        field of the JSON object which the result should be ordered by, it is
        less effective than the ordering via db_orderby; be aware this parameter
        can be used only for objects for which the caching is turned on
      desc
        turn on the descending order
      stats:
        turn on the enrichment of the objects by some statistics
      html
        turn on the HTML version of the API
      environment
        turn on the enrichment of the related environment values
    """
    if not should_cache and 'json_orderby' in request.GET:
        return render_json(request, {
            'error': "Can't order the result according to the JSON field, because the caching for this type of object is turned off. See the documentation."
            },
            template='questions_json.html', help_text=show_more.__doc__, status=501)
    if not should_cache and 'all' in request.GET:
        return render_json(request, {
            'error': "Can't get all objects, because the caching for this type of object is turned off. See the documentation."
            },
            template='questions_json.html', help_text=show_more.__doc__, status=501)
    if to_json_kwargs is None:
        to_json_kwargs = {}
    time_start = time_lib()
    limit = min(int(request.GET.get('limit', 10)), 100)
    page = int(request.GET.get('page', 0))
    try:
        objs = get_fun(request, object_class)
        if 'db_orderby' in request.GET:
            objs = objs.order_by(('-' if 'desc' in request.GET else '') + request.GET['db_orderby'].strip('/'))
        if 'all' not in request.GET and 'json_orderby' not in request.GET:
            objs = objs[page * limit:(page + 1) * limit]
        cache_key = 'proso_common_sql_json_%s' % hashlib.sha1((str(objs.query) + str(to_json_kwargs)).encode()).hexdigest()
        cached = cache.get(cache_key)
        if should_cache and cached:
            list_objs = json_lib.loads(cached)
        else:
            list_objs = [x.to_json(**to_json_kwargs) for x in list(objs)]
            if should_cache:
                cache.set(cache_key, json_lib.dumps(list_objs), 60 * 60 * 24 * 30)
        LOGGER.debug('loading objects in show_more view took %s seconds', (time_lib() - time_start))
        json = post_process_fun(request, list_objs)
        if 'json_orderby' in request.GET:
            time_before_json_sort = time_lib()
            json.sort(key=lambda x: (-1 if 'desc' in request.GET else 1) * x[request.GET['json_orderby']])
            if 'all' not in request.GET:
                json = json[page * limit:(page + 1) * limit]
            LOGGER.debug('sorting objects according to JSON field took %s seconds', (time_lib() - time_before_json_sort))
        return render_json(request, json, template=template, help_text=show_more.__doc__)
    except EmptyResultSet:
        return render_json(request, [], template=template, help_text=show_more.__doc__)