From 2621315fc2d52f2b11b95704c06c36dc7fdc6339 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 5 Jun 2015 13:11:24 -0400 Subject: [refactor] move collect_plugins to leap.common --- client/src/leap/soledad/client/api.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'client/src/leap') diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py index 01c06f20..fd91ff8b 100644 --- a/client/src/leap/soledad/client/api.py +++ b/client/src/leap/soledad/client/api.py @@ -47,6 +47,7 @@ from twisted.plugin import getPlugins from zope.interface import implements from leap.common.config import get_path_prefix +from leap.common.plugins import collect_plugins from leap.soledad.common import SHARED_DB_NAME from leap.soledad.common import soledad_assert @@ -72,28 +73,6 @@ Soledad client and server. """ SOLEDAD_CERT = None -# A whitelist of modules from where to collect plugins dynamically. -# For the moment restricted to leap namespace, but the idea is that we can pass -# other "trusted" modules as options to the initialization of soledad. -PLUGGABLE_LEAP_MODULES = ('mail', 'keymanager') - - -# TODO move to leap.common - -def collect_plugins(interface): - """ - Traverse a whitelist of modules and collect all the plugins that implement - the passed interface. - """ - plugins = [] - for namespace in PLUGGABLE_LEAP_MODULES: - try: - module = __import__('leap.%s.plugins' % namespace, fromlist='.') - plugins = plugins + list(getPlugins(interface, module)) - except ImportError: - pass - return plugins - class Soledad(object): """ -- cgit v1.2.3