summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-06-05 13:11:24 -0400
committerKali Kaneko <kali@leap.se>2015-06-05 13:11:24 -0400
commit251155bf9228ac2f80ec6cf875e512e8b0ada0ac (patch)
tree3fc84f5d6a92b27911889543df9d3f7a752ee6af
parentc849a67b986c826f128b045181d8b880744de104 (diff)
[refactor] move collect_plugins to leap.common
-rw-r--r--client/src/leap/soledad/client/api.py23
1 files changed, 1 insertions, 22 deletions
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):
"""