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)
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)
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)