diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-30 14:11:24 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-30 14:11:24 -0600 |
commit | 3076cb4d2fa1be023a1c72d70cbdf5024047ff2a (patch) | |
tree | 0f20bf334d31592cda9bdc5bae7fe91c218a42a3 | |
parent | 6879140db790a23a8782f7200400f2b58a69f6a0 (diff) | |
download | freeipa-3076cb4d2fa1be023a1c72d70cbdf5024047ff2a.tar.gz freeipa-3076cb4d2fa1be023a1c72d70cbdf5024047ff2a.tar.xz freeipa-3076cb4d2fa1be023a1c72d70cbdf5024047ff2a.zip |
Plugin.set_api() now sets convience instance attributes from api for env, context, log, and all NameSpace
-rw-r--r-- | ipalib/plugable.py | 11 | ||||
-rwxr-xr-x | lite-xmlrpc.py | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 2f86fa220..d10ff7973 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -351,6 +351,15 @@ class Plugin(ReadOnly): assert self.__api is None, 'set_api() can only be called once' assert api is not None, 'set_api() argument cannot be None' self.__api = api + if not isinstance(api, API): + return + for name in api: + assert not hasattr(self, name) + setattr(self, name, api[name]) + for name in ('env', 'context', 'log'): + if hasattr(api, name): + assert not hasattr(self, name) + setattr(self, name, getattr(api, name)) def __repr__(self): """ @@ -768,7 +777,7 @@ class API(DictProxy): self.env.log, self.env.verbose, ) - object.__setattr__(self, 'logger', logger) + object.__setattr__(self, 'log', logger) def load_plugins(self): """ diff --git a/lite-xmlrpc.py b/lite-xmlrpc.py index 3483ceb5a..988cc2ba1 100755 --- a/lite-xmlrpc.py +++ b/lite-xmlrpc.py @@ -147,7 +147,7 @@ if __name__ == '__main__': api.bootstrap(context='server') api.load_plugins() api.finalize() - logger = api.logger + logger = api.log # Set up the server XMLRPCServer = StoppableXMLRPCServer( |