From c3bf5ad8579e6f09aba558a68de947b2be398619 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 5 Aug 2008 03:21:52 +0000 Subject: 43: Fleshed out new plugable.API class; added corresponding unit tests --- ipalib/plugable.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ipalib/plugable.py') diff --git a/ipalib/plugable.py b/ipalib/plugable.py index f298e97e..32cbe033 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -281,4 +281,13 @@ class Registrar(object): class API(ReadOnly): def __init__(self, registrar): for (base, plugins) in registrar: - pass + ns = NameSpace(self.__plugin_iter(base, plugins)) + assert not hasattr(self, base.__name__) + object.__setattr__(self, base.__name__, ns) + + def __plugin_iter(self, base, plugins): + assert issubclass(base.proxy, Proxy) + for cls in plugins: + plugin = cls(self) + assert plugin.api is self + yield base.proxy(plugin) -- cgit