提交 98d69535 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #957 from clebergnu/loader_unique_dispatcher_propagate

Make loader registration unique and make dispatcher propagate exceptions
...@@ -27,7 +27,8 @@ class Dispatcher(ExtensionManager): ...@@ -27,7 +27,8 @@ class Dispatcher(ExtensionManager):
self.load_failures = [] self.load_failures = []
super(Dispatcher, self).__init__(namespace=namespace, super(Dispatcher, self).__init__(namespace=namespace,
invoke_on_load=True, invoke_on_load=True,
on_load_failure_callback=self.store_load_failure) on_load_failure_callback=self.store_load_failure,
propagate_map_exceptions=True)
@staticmethod @staticmethod
def store_load_failure(manager, entrypoint, exception): def store_load_failure(manager, entrypoint, exception):
......
...@@ -102,7 +102,8 @@ class TestLoaderProxy(object): ...@@ -102,7 +102,8 @@ class TestLoaderProxy(object):
def register_plugin(self, plugin): def register_plugin(self, plugin):
try: try:
if issubclass(plugin, TestLoader): if issubclass(plugin, TestLoader):
self.registered_plugins.append(plugin) if plugin not in self.registered_plugins:
self.registered_plugins.append(plugin)
else: else:
raise ValueError raise ValueError
except ValueError: except ValueError:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册