def render_graphs(app, space, graphs): if _request_wants_json(): return jsonify( graphs = graphs ) html_graphs = [] for graph in graphs: element = {} element['name'] = graph element['url'] = str(Routes.GRAPH).\ replace('<path:space>', urllib.quote_plus(space)).\ replace('<path:graph>', urllib.quote_plus(graph)) html_graphs.append( element ) #print graphs return render_template('graphs.html', space = space, graphs = html_graphs )
def render_space(space): if _request_wants_json(): space_dict = {} space_dict['name'] = space space_escaped = urllib.quote_plus(space) space_dict['resources'] = [] element = {} element['name'] = "query/" element['url'] = "%s/query" % space_escaped space_dict['resources'].append(element) return jsonify( space = space_dict ) return render_template('space.html', space = space, resources = ["graphs", "query"] )
def render_spaces(spaces): if _request_wants_json(): return jsonify( spaces = spaces ) return render_template('spaces.html', spaces = spaces )