Пример #1
0
    def loadDataStore(self, configDict, defaults, addNewResourceHook):
        if defaults:
            defaults = copy.deepcopy(defaults)
            utils.recursiveUpdate(defaults, configDict, self.nonMergableConfigDicts)
            configDict = defaults
        self.model_uri = configDict.get('model_uri')
        if not self.model_uri:
            import socket
            self.model_uri= 'http://' + socket.getfqdn() + '/'

        dataStoreFactory = configDict.get('datastore_factory', DataStore.BasicStore)
        dataStore = dataStoreFactory(self, **configDict)
        dataStore.addTrigger = self.txnSvc.addHook
        dataStore.removeTrigger = self.txnSvc.removeHook

        if addNewResourceHook:
            #newResourceHook is optional since it's expensive
            dataStore.newResourceTrigger = self.txnSvc.newResourceHook
            
        return dataStore
Пример #2
0
 def updateFromConfigFile(self, filepath):
     config = {}
     execfile(filepath, config, config)
     utils.recursiveUpdate(self, config, RequestProcessor.nonMergableConfigDicts)