Пример #1
0
    def setUpBackend(self):
        self.backendManager = PluginManager(plugin_info_ext='relo')
        self.backendManager.setPluginPlaces(["relo/core/backend"])
        self.backendManager.locatePlugins()
        self.backendManager.loadPlugins("<class 'relo.core.interfaces.Backend'>", ['redis'])

        for plugin in self.backendManager.getAllPlugins():
            self.backendManager.activatePluginByName(plugin.name)

        for plugin in self.backendManager.getAllPlugins():
            if plugin.name == conf.readConfig('core.index'):
                self.db = plugin.plugin_object
                self.db.init()
Пример #2
0
        logger.error(str(msg))
        return 1

    ########## INIT ##########
    logger.debug(results)
    core.init()


    ########## CONFIG ##########
    if results.which.startswith('config'):
        if results.which == 'config.list':
            conf.listConfig(None)
        if results.which == 'config.write':
            conf.writeConfig(results.key, results.value)
        if results.which == 'config.read':
            print conf.readConfig(results.key)
    ########## UPDATE ##########
    elif results.which == 'update':
        from relo.core.update import ReloUpdater
        curVersion = __version__
        relo = ReloUpdater(curVersion)
        if results.key in ['master', 'develop']:
            relo.update(results.key)
        else:
            logger.error('Invalid Repo-Key')
    ########## CRAWL ##########
    elif results.which == 'crawl':
        url = results.url

        sTime = time.time()