def get_nodes(path): nodes = [get_node_or_shell(part) for part in path.split('/') if part.strip()] if request.is_xhr: nodes = map(render_details, nodes) return json_response(nodes) nodes.insert(0, get_node_or_shell('index')) nodes = map(render_details, nodes) types = wiki.get_types() return render_template("index.html", **locals())
try: path = sys.argv[2] except: usage() with open(path) as o: data = json.load(o) for node in data: redis.set( 'n:' + node['slug'], json.dumps(node)) print "Loadded data from %s" % path elif command == 'fixdb': import wiki, search types = wiki.get_types() for k, v in types.items(): if k == 'type': continue try: wiki.put_type(k, v) except wiki.FormError, e: print e.field search.rebuild_index() wiki.rebuild_nodes() print "Wiki Rebuilt." elif command == 'flushdb': redis.flushdb() else: