def addRepo(self, url): r = Repo() r.name = 'unknown' r.info_url = '' r.url = url r.save() common.REPOMANAGER = RepoManager(Repo.select()) t = tasks.TaskThread(tasks.cacheRepos) t.start() return ''
def removeRepo(self, url): try: repo = Repo.get(Repo.url == url) except Repo.DoesNotExist: return '' repo.delete_instance() common.REPOMANAGER = RepoManager(Repo.select()) t = tasks.TaskThread(tasks.cacheRepos) t.start() return ''
def postDB(): """mostly plugin and common init""" common.PM = PluginManager() common.PM.cache( debug=common.STARTOPTIONS.pluginImportDebug, systemOnly=True, ) # load system config ! common.SYSTEM = common.PM.getPluginByIdentifier( common.STARTOPTIONS.systemIdentifer, 'Default' ) # yeah SYSTEM is a plugin, identifier permits to be sure to get the right plugin. # system config loaded # init i18n common.SYSTEM._switchLanguage() # init updater common.UPDATER = CoreUpdater() common.REPOMANAGER = RepoManager(Repo.select()) if not os.path.isabs(common.SYSTEM.c.https_cert_filepath): common.SYSTEM.c.https_cert_filepath = os.path.join( xdm.DATADIR, common.SYSTEM.c.https_cert_filepath) if not os.path.isabs(common.SYSTEM.c.https_key_filepath): common.SYSTEM.c.https_key_filepath = os.path.join( xdm.DATADIR, common.SYSTEM.c.https_key_filepath) # prepare to load other plugins if not common.SYSTEM.c.extra_plugin_path or common.STARTOPTIONS.datadir is not None: log.info('Setting extra plugin path to %s' % xdm.PLUGININSTALLPATH) common.SYSTEM.c.extra_plugin_path = xdm.PLUGININSTALLPATH if os.path.isdir(common.SYSTEM.c.extra_plugin_path): log('Adding eyternal plugin path %s to the python path' % common.SYSTEM.c.extra_plugin_path) sys.path.append(common.SYSTEM.c.extra_plugin_path) common.PM.cache(debug=common.STARTOPTIONS.pluginImportDebug) common.SYSTEM = common.PM.getPluginByIdentifier( common.STARTOPTIONS.systemIdentifer, 'Default' ) # yeah SYSTEM is a plugin, identifier permits to be sure to get the right plugin. # generate api key if api is aktive if common.SYSTEM.c.api_active and not common.SYSTEM.c.api_key: log.info('Generating your first API key for XDM') common.SYSTEM.c.api_key = helper.generateApiKey() # lets init all plugins once for plugin in common.PM.getAll(): log("Plugin %s loaded successfully" % plugin.name) # migrate core t = tasks.TaskThread(common.UPDATER.migrate) t.start()
def postDB(): """mostly plugin and common init""" common.PM = PluginManager() common.PM.cache( debug=common.STARTOPTIONS.pluginImportDebug, systemOnly=True, ) # load system config ! common.SYSTEM = common.PM.getSystems('Default')[ 0] # yeah SYSTEM is a plugin # system config loaded if not os.path.isabs(common.SYSTEM.c.https_cert_filepath): common.SYSTEM.c.https_cert_filepath = os.path.join( xdm.DATADIR, common.SYSTEM.c.https_cert_filepath) if not os.path.isabs(common.SYSTEM.c.https_key_filepath): common.SYSTEM.c.https_key_filepath = os.path.join( xdm.DATADIR, common.SYSTEM.c.https_key_filepath) # prepare to load other plugins if not common.SYSTEM.c.extra_plugin_path: log.info('Setting extra plugin path to %s' % xdm.PLUGININSTALLPATH) common.SYSTEM.c.extra_plugin_path = xdm.PLUGININSTALLPATH if os.path.isdir(common.SYSTEM.c.extra_plugin_path): log('Adding eyternal plugin path %s to the python path' % common.SYSTEM.c.extra_plugin_path) sys.path.append(common.SYSTEM.c.extra_plugin_path) common.PM.cache(debug=common.STARTOPTIONS.pluginImportDebug) common.SYSTEM = common.PM.getSystems('Default')[ 0] # yeah SYSTEM is a plugin # generate api key if api is aktive if common.SYSTEM.c.api_active and not common.SYSTEM.c.api_key: log.info('Generating your first API key for XDM') common.SYSTEM.c.api_key = helper.generateApiKey() # lets init all plugins once for plugin in common.PM.getAll(): log("Plugin %s loaded successfully" % plugin.name) # updater common.UPDATER = CoreUpdater() common.REPOMANAGER = RepoManager(Repo.select())