From 6a7f5326da004d7a0d78fe5a6d91f9630d832f51 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 27 Dec 2019 16:58:20 +0100 Subject: Plugins: use import_module for module in poezio_plugins And do not rely on the "module name" to index the plugins, use the intended plugin name instead. --- poezio/plugin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'poezio/plugin.py') diff --git a/poezio/plugin.py b/poezio/plugin.py index 1995d7cd..c3d10b38 100644 --- a/poezio/plugin.py +++ b/poezio/plugin.py @@ -395,17 +395,18 @@ class BasePlugin(object, metaclass=SafetyMetaclass): default_config = None - def __init__(self, plugin_api, core, plugins_conf_dir): + def __init__(self, name, plugin_api, core, plugins_conf_dir): + self.__name = name self.core = core # More hack; luckily we'll never have more than one core object SafetyMetaclass.core = core - conf = plugins_conf_dir / (self.__module__ + '.cfg') + conf = plugins_conf_dir / (self.__name + '.cfg') try: self.config = PluginConfig( - conf, self.__module__, default=self.default_config) + conf, self.__name, default=self.default_config) except Exception: log.debug('Error while creating the plugin config', exc_info=True) - self.config = PluginConfig(conf, self.__module__) + self.config = PluginConfig(conf, self.__name) self._api = plugin_api[self.name] self.init() @@ -414,7 +415,7 @@ class BasePlugin(object, metaclass=SafetyMetaclass): """ Get the name (module name) of the plugin. """ - return self.__module__ + return self.__name @property def api(self): -- cgit v1.2.3