def handleGet(wfile, request, session): factory=DependanciesSVGFactory() # productionId, fileId productionId=session["production_id"] indexer.updateIndex(productionId) production = indexer.getProduction(productionId) fileId=request.get("file_id", session.get("file_id",None)) detail = request.get("display", "detail") == "detail" view = request.get("view", "uses") factory.RenderNavigation=request.get("navigation", "0")=="1" factory.Detail = detail filter = request.get("filter", "all") factory.Production=production result=[] if fileId == None: view="production" if view == "production": result = indexer.queryDependancy(productionId, filter) if view == "uses": result = indexer.queryDependancyUses(productionId, fileId, filter) if view == "used": result = indexer.queryDependancyUsed(productionId, fileId, filter) if view == "neighbour": result = indexer.queryDependancyNeighbour(productionId, fileId, filter) items = [] for item in result: rec = {} rec["source_file_id"]=item[4] rec["source_file_location"]=item[0] rec["target_file_id"]=item[5] rec["target_file_location"]=item[1] rec["element_name"]=item[3] rec["element_type"]=item[2] items.append(rec) wfile.write(json.dumps(items).encode());
def handleGetSVG(wfile, request, session): factory=DependanciesSVGFactory() # productionId, fileId productionId=session["production_id"] indexer.updateIndex(productionId) production = indexer.getProduction(productionId) fileId=request.get("file_id", session.get("file_id",None)) detail = request.get("display", "detail") == "detail" view = request.get("view", "uses") factory.RenderNavigation=request.get("navigation", "0")=="1" factory.Detail = detail filter = request.get("filter", "all") factory.Production=production result=[] if fileId == None: view="production" if view == "production": result = indexer.queryDependancy(productionId, filter) if view == "uses": result = indexer.queryDependancyUses(productionId, fileId, filter) if view == "used": result = indexer.queryDependancyUsed(productionId, fileId, filter) if view == "neighbour": result = indexer.queryDependancyNeighbour(productionId, fileId, filter) if detail: display="detail" else: display="global" factory.URLTemplate = "/".join(["svg", "1", view, filter, display]) factory.Render(wfile, result)