diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-01 21:25:46 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-01 21:25:46 +0000 |
commit | 74f5719078adfcfdf8b98bf97f0828dd150c840d (patch) | |
tree | d5ce275251f93b1a72df10e6494820276053326e /ipalib/plugable.py | |
parent | a0f480a414d2aa3a5f79e77026ff9183c1dd3a48 (diff) | |
download | freeipa.git-74f5719078adfcfdf8b98bf97f0828dd150c840d.tar.gz freeipa.git-74f5719078adfcfdf8b98bf97f0828dd150c840d.tar.xz freeipa.git-74f5719078adfcfdf8b98bf97f0828dd150c840d.zip |
42: plugable.Plugin.__init__() now takes the plugable.API instance as its single argument
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r-- | ipalib/plugable.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 9025c1db..f298e97e 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -49,6 +49,16 @@ class Plugin(object): Base class for all plugins. """ + def __init__(self, api): + self.__api = api + + def __get_api(self): + """ + Returns the plugable.API object this plugin has been instatiated in. + """ + return self.__api + api = property(__get_api) + def __get_name(self): """ Returns the class name of this instance. @@ -132,6 +142,8 @@ class NameSpace(ReadOnly): def __init__(self, items): """ + `items` should be an iterable providing the members of this + NameSpace. """ object.__setattr__(self, '_NameSpace__items', tuple(items)) @@ -182,7 +194,6 @@ class NameSpace(ReadOnly): raise KeyError('NameSpace has no item for key %r' % key) - class Registrar(object): def __init__(self, *allowed): """ @@ -265,3 +276,9 @@ class Registrar(object): """ for base in self.__allowed: yield (base, self.__d[base.__name__].values()) + + +class API(ReadOnly): + def __init__(self, registrar): + for (base, plugins) in registrar: + pass |