summaryrefslogtreecommitdiffstats
path: root/ipalib/plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-05 05:12:09 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-05 05:12:09 +0000
commitd134b483066ae9d3a7e76d6e491f0f91eba6a954 (patch)
tree9e2a4a588b140c05cd8d29585a6b3c5355454f71 /ipalib/plugable.py
parent2b3c2238f6ecb5fc496acc50fc81f5b658d23c4b (diff)
downloadfreeipa.git-d134b483066ae9d3a7e76d6e491f0f91eba6a954.tar.gz
freeipa.git-d134b483066ae9d3a7e76d6e491f0f91eba6a954.tar.xz
freeipa.git-d134b483066ae9d3a7e76d6e491f0f91eba6a954.zip
46: plugable.API now takes allowed base class in __init__ and creates Registrar at API.register, thereby coupling the two; updated correspending unit tests
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r--ipalib/plugable.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 80349090..70743f5a 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -289,9 +289,15 @@ class Registrar(object):
class API(ReadOnly):
- def __init__(self, registrar):
+ def __init__(self, *allowed):
+ object.__setattr__(self, 'register', Registrar(*allowed))
object.__setattr__(self, '_API__plugins', [])
- for (base, plugins) in registrar:
+
+ def __call__(self):
+ """
+ Finalize the registration, instantiate the plugins.
+ """
+ for (base, plugins) in self.register:
ns = NameSpace(self.__plugin_iter(base, plugins))
assert not hasattr(self, base.__name__)
object.__setattr__(self, base.__name__, ns)