Exemplo n.º 1
0
def server_get(server_id=None):
    if server_id:
        return utils.jsonify(server.get_dict(server_id))

    servers = []

    for svr in server.iter_servers_dict():
        servers.append(svr)

    return utils.jsonify(servers)
Exemplo n.º 2
0
def server_get(server_id=None):
    if server_id:
        return utils.jsonify(server.get_dict(server_id))

    servers = []

    for svr in server.iter_servers_dict():
        servers.append(svr)

    return utils.jsonify(servers)
Exemplo n.º 3
0
def server_get(server_id=None):
    if server_id:
        return utils.jsonify(server.get_dict(server_id))

    servers = []
    page = flask.request.args.get('page', None)
    page = int(page) if page else page

    for svr in server.iter_servers_dict(page=page):
        servers.append(svr)

    if page is not None:
        return utils.jsonify({
            'page': page,
            'page_total': server.get_server_page_total(),
            'servers': servers,
        })
    else:
        return utils.jsonify(servers)
Exemplo n.º 4
0
def server_get(server_id=None):
    if server_id:
        return utils.jsonify(server.get_dict(server_id))

    servers = []
    page = flask.request.args.get('page', None)
    page = int(page) if page else page

    for svr in server.iter_servers_dict(page=page):
        servers.append(svr)

    if page is not None:
        return utils.jsonify({
            'page': page,
            'page_total': server.get_server_page_total(),
            'servers': servers,
        })
    else:
        return utils.jsonify(servers)
Exemplo n.º 5
0
def server_get(server_id=None):
    if server_id:
        if settings.app.demo_mode:
            resp = utils.demo_get_cache()
            if resp:
                return utils.jsonify(resp)

        resp = server.get_dict(server_id)
        if settings.app.demo_mode:
            utils.demo_set_cache(resp)
        return utils.jsonify(resp)

    servers = []
    page = flask.request.args.get('page', None)
    page = int(page) if page else page

    if settings.app.demo_mode:
        resp = utils.demo_get_cache(page)
        if resp:
            return utils.jsonify(resp)

    for svr in server.iter_servers_dict(page=page):
        servers.append(svr)

    if page is not None:
        resp = {
            'page': page,
            'page_total': server.get_server_page_total(),
            'servers': servers,
        }
    else:
        resp = servers

    if settings.app.demo_mode:
        utils.demo_set_cache(resp, page)
    return utils.jsonify(resp)
Exemplo n.º 6
0
def server_get(server_id=None):
    if server_id:
        if settings.app.demo_mode:
            resp = utils.demo_get_cache()
            if resp:
                return utils.jsonify(resp)

        resp = server.get_dict(server_id)
        if settings.app.demo_mode:
            utils.demo_set_cache(resp)
        return utils.jsonify(resp)

    servers = []
    page = flask.request.args.get('page', None)
    page = int(page) if page else page

    if settings.app.demo_mode:
        resp = utils.demo_get_cache(page)
        if resp:
            return utils.jsonify(resp)

    for svr in server.iter_servers_dict(page=page):
        servers.append(svr)

    if page is not None:
        resp = {
            'page': page,
            'page_total': server.get_server_page_total(),
            'servers': servers,
        }
    else:
        resp = servers

    if settings.app.demo_mode:
        utils.demo_set_cache(resp, page)
    return utils.jsonify(resp)