diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-12 21:45:54 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-12 21:45:54 +0000 |
commit | 86405236325204cb5750ce79f674a5ab01114fa7 (patch) | |
tree | 3e53d9fa91d8414c5c6d834687eed3cf31f95713 /ipalib/plugable.py | |
parent | 9ac8a8b49984ec5727b9da4803ae7823a9e44e13 (diff) | |
download | freeipa-86405236325204cb5750ce79f674a5ab01114fa7.tar.gz freeipa-86405236325204cb5750ce79f674a5ab01114fa7.tar.xz freeipa-86405236325204cb5750ce79f674a5ab01114fa7.zip |
119: Added ProxyTarget.implemented_by() classmethod; added corresponding unit tests
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r-- | ipalib/plugable.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index b607f0fa..a91063e7 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -135,6 +135,18 @@ class ProxyTarget(ReadOnly): "must be str, frozenset, or have frozenset '__public__' attribute" ) + @classmethod + def implemented_by(cls, arg): + if inspect.isclass(arg): + subclass = arg + else: + subclass = arg.__class__ + assert issubclass(subclass, cls), 'must be subclass of %r' % cls + for name in cls.__public__: + if not hasattr(subclass, name): + return False + return True + class Proxy(ReadOnly): """ |