def handleGetFileView(wfile, request, session):
    """Service to retrieve all file level information
    being:
        production
        file
        elements of the file
        references of the file
        used by of the file
    """
    productionId=int(request["production_id"])
    fileId=int(request["file_id"])

    indexer.updateIndex(productionId)

    production = indexer.getProduction(productionId)
    file = indexer.getFileDetails(fileId)
    elements = indexer.getFileElements(fileId)
    references = indexer.getFileReferences(fileId)
    usedby = indexer.getFileUsedBy(fileId)
    
    result = []
    result.append(productionToObject(production))
    if file != None:
        result.append(fileDetailToObject(file))
    else:
        file=indexer.getFile(fileId)
        result.append(fileToObject(file))
        
    result.append(elementsToObject(elements))
    result.append(referencesToObject(references))
    result.append(usedbysToObject(usedby))
    wfile.write(json.dumps(result).encode())
def handleGetFileView(wfile, request, session):
    """Service to retrieve all file level information
    being:
        production
        file
        elements of the file
        references of the file
        used by of the file
    """
    productionId = int(request["production_id"])
    fileId = int(request["file_id"])

    indexer.updateIndex(productionId)

    production = indexer.getProduction(productionId)
    file = indexer.getFileDetails(fileId)
    elements = indexer.getFileElements(fileId)
    references = indexer.getFileReferences(fileId)
    usedby = indexer.getFileUsedBy(fileId)

    result = []
    result.append(productionToObject(production))
    if file != None:
        result.append(fileDetailToObject(file))
    else:
        file = indexer.getFile(fileId)
        result.append(fileToObject(file))

    result.append(elementsToObject(elements))
    result.append(referencesToObject(references))
    result.append(usedbysToObject(usedby))
    wfile.write(json.dumps(result).encode())
def handleGetProductionView(wfile, request, session):
    """Service to retrieve all production level information
    being:
        production
        files of the production
        scenes of the production
        missing links of the production
    """
    if ("production_id" in request):
        production = indexer.getProduction(request["production_id"])
    else:
        production = indexer.getActiveProduction()
    result = []
    if production is not None:
        productionId = production[0]
        session["production_id"] = productionId  #fix for dependancy services..
        indexer.updateIndex(productionId)
        files = indexer.getProductionFiles(productionId)
        scenes = indexer.getAllScenes(productionId)
        errors = indexer.getConsistencyErrors(productionId)
        try:
            states = svn.svnStat(production[2])
        except pysvn.ClientError as e:
            states = []
        temp = {}
        assignedFiles = []
        for stat in states:
            if stat.entry is None:
                if path.isfile(stat.path):
                    temp[path.normcase(
                        stat.path)] = [None, None,
                                       str(stat.text_status)]
            elif stat.entry.kind != svn.pysvn.node_kind.dir:
                temp[path.normcase(stat.path)] = [
                    stat.entry.commit_revision.number,
                    stat.entry.commit_author,
                    str(stat.text_status)
                ]
        for file in files:
            abspath = path.normcase(path.join(production[2], file[3]))
            if abspath in temp:
                ass = [file, temp[abspath]]
                del temp[abspath]
            else:
                ass = [file, ["", "", "unversioned"]]
            assignedFiles.append(ass)
        for key, arr in temp.items():
            ass = [[
                -1, productionId,
                path.basename(key),
                path.relpath(key, production[2]), 0, 0
            ], arr]
            assignedFiles.append(ass)
        result.append(productionToObject(production))
        result.append(files2ToObject(assignedFiles))
        result.append(scenesToObject(scenes))
        result.append(errorsToObject(errors))
    wfile.write(json.dumps(result).encode())
def handleGetProductionView(wfile, request, session):
    """Service to retrieve all production level information
    being:
        production
        files of the production
        scenes of the production
        missing links of the production
    """
    if ("production_id" in request ) :
        production = indexer.getProduction(request["production_id"])
    else :
        production = indexer.getActiveProduction()
    result = []
    if production is not None:
        productionId=production[0]
        session["production_id"]=productionId #fix for dependancy services..
        indexer.updateIndex(productionId)
        files = indexer.getProductionFiles(productionId)
        scenes = indexer.getAllScenes(productionId)
        errors = indexer.getConsistencyErrors(productionId)
        try:
            states = svn.svnStat(production[2])
        except pysvn.ClientError as e:
            states=[]
        temp = {}
        assignedFiles=[]
        for stat in states:
            if stat.entry is None:
                if path.isfile(stat.path):
                    temp[path.normcase(stat.path)] = [None,None,str(stat.text_status)]
            elif stat.entry.kind != svn.pysvn.node_kind.dir:
                temp[path.normcase(stat.path)] = [stat.entry.commit_revision.number,stat.entry.commit_author,str(stat.text_status)]
        for file in files:
            abspath = path.normcase(path.join(production[2], file[3]))
            if abspath in temp:
                ass =[file, temp[abspath]]
                del temp[abspath]
            else:
                ass =[file, ["","","unversioned"]]
            assignedFiles.append(ass)
        for key, arr in temp.items():
            ass = [[-1, productionId, path.basename(key), path.relpath(key, production[2]), 0,0 ], arr]
            assignedFiles.append(ass);
        result.append(productionToObject(production))
        result.append(files2ToObject(assignedFiles))
        result.append(scenesToObject(scenes))
        result.append(errorsToObject(errors))
    wfile.write(json.dumps(result).encode())
Exemple #5
0
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());
Exemple #6
0
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)
Exemple #7
0
def test():
    production = indexer.getActiveProduction()
    indexer.deleteElements(production[0])
    indexer.updateIndex(production[0])
def test():
    production=indexer.getActiveProduction()
    indexer.deleteElements(production[0])
    indexer.updateIndex(production[0])