Exemplo n.º 1
0
    def __init__(self, graph, mods, folder, doc):
        untrustme1 = list()
        untrustme2 = list()
        dbgstr('Initializing protocol with root: ' + folder)
        self._metafolder = folder
        self._rootdir = os.getcwd()
        self._resmap = dict()
        self._doc = doc

        self._graphres = resource('graph', os.path.join(folder,'graph.grp'))
        untrustme1 = self._updateGraph(graph)

        for res in self._getResNames():
            newres = resource(res, folder+'/'+res+'.res')
            #print res, newres
            self._addResource(res, newres)

        for mod in self._getNodeNames():
            newres = resource(mod, folder+'/'+mod+'.mod')
            self._modules[mod] = newres

        untrustme2 = self._updateModules(mods)

        for mod in untrustme1:
            self.untrust(mod)
        for mod in untrustme2:
            self.untrust(mod)
Exemplo n.º 2
0
 def _updateModules(self, mods):
     untrustme = list()
     for modname in mods:
         if modname in self._modules.keys():
             self._modules[modname].setValue(mods[modname])
             if self._modules[modname].changed():
                 untrustme.append(modname)
                 #self.untrust(self._modules[modname].name())
                 self._modhelp[modname] = inspect.getdoc(self._modules[modname].getValue())
             self._modules[modname].update()
         else:
             dbgstr('New module: ' + modname)
             self._modules[modname] = resource(modname,
                 self._metafolder+'/'+modname+'.dmp' )
             self._addResource(modname, self._modules[modname])
             self._modules[modname].setValue(mods[modname])
             self._modules[modname].update()
     return untrustme