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())
Exemplo n.º 3
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])