summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2010-01-27 05:59:09 -0700
committerRob Crittenden <rcritten@redhat.com>2010-01-28 13:32:00 -0500
commit1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f (patch)
treedbd92082b8d84789bd980a689ecc90c37213db67 /ipalib
parentb7cda86697cfb8ffc25ab5d3c051f181e145648d (diff)
downloadfreeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.tar.gz
freeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.tar.xz
freeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.zip
Remove __public__ and __proxy__ hold-overs from Plugin class
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/backend.py2
-rw-r--r--ipalib/frontend.py35
-rw-r--r--ipalib/plugable.py73
3 files changed, 1 insertions, 109 deletions
diff --git a/ipalib/backend.py b/ipalib/backend.py
index 8aa057802..03f4ce396 100644
--- a/ipalib/backend.py
+++ b/ipalib/backend.py
@@ -32,8 +32,6 @@ class Backend(plugable.Plugin):
Base class for all backend plugins.
"""
- __proxy__ = False # Backend plugins are not wrapped in a PluginProxy
-
class Connectible(Backend):
"""
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 2c1168a5b..1cc2ea278 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -359,20 +359,6 @@ class Command(HasParam):
ipalib.frontend.my_command()
"""
- __public__ = frozenset((
- 'get_default',
- 'convert',
- 'normalize',
- 'validate',
- 'execute',
- '__call__',
- 'args',
- 'options',
- 'params',
- 'params_2_args_options',
- 'args_options_2_params',
- 'output_for_cli',
- ))
takes_options = tuple()
takes_args = tuple()
args = None
@@ -875,16 +861,6 @@ class LocalOrRemote(Command):
class Object(HasParam):
- __public__ = frozenset((
- 'backend',
- 'methods',
- 'properties',
- 'params',
- 'primary_key',
- 'params_minus_pk',
- 'params_minus',
- 'get_dn',
- ))
backend = None
methods = None
properties = None
@@ -1011,10 +987,6 @@ class Attribute(Plugin):
only the base class for the `Method` and `Property` classes. Also see
the `Object` class.
"""
- __public__ = frozenset((
- 'obj',
- 'obj_name',
- ))
__obj = None
def __init__(self):
@@ -1112,7 +1084,6 @@ class Method(Attribute, Command):
attribute-to-object association. Also see the `Object` and the
`Property` classes.
"""
- __public__ = Attribute.__public__.union(Command.__public__)
extra_options_first = False
extra_args_first = False
@@ -1125,12 +1096,6 @@ class Method(Attribute, Command):
class Property(Attribute):
- __public__ = frozenset((
- 'rules',
- 'param',
- 'type',
- )).union(Attribute.__public__)
-
klass = Str
default = None
default_from = None
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index ecccb79e3..b6ba73255 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -154,11 +154,9 @@ class Plugin(ReadOnly):
"""
Base class for all plugins.
"""
- __public__ = frozenset()
- __proxy__ = True
- __api = None
def __init__(self):
+ self.__api = None
cls = self.__class__
self.name = cls.__name__
self.module = cls.__module__
@@ -189,75 +187,6 @@ class Plugin(ReadOnly):
return self.__api
api = property(__get_api)
- @classmethod
- def implements(cls, arg):
- """
- Return True if this class implements ``arg``.
-
- There are three different ways this method can be called:
-
- With a <type 'str'> argument, e.g.:
-
- >>> class base(Plugin):
- ... __public__ = frozenset(['attr1', 'attr2'])
- ...
- >>> base.implements('attr1')
- True
- >>> base.implements('attr2')
- True
- >>> base.implements('attr3')
- False
-
- With a <type 'frozenset'> argument, e.g.:
-
- With any object that has a `__public__` attribute that is
- <type 'frozenset'>, e.g.:
-
- Unlike ProxyTarget.implemented_by(), this returns an abstract answer
- because only the __public__ frozenset is checked... a ProxyTarget
- need not itself have attributes for all names in __public__
- (subclasses might provide them).
- """
- assert type(cls.__public__) is frozenset
- if isinstance(arg, str):
- return arg in cls.__public__
- if type(getattr(arg, '__public__', None)) is frozenset:
- return cls.__public__.issuperset(arg.__public__)
- if type(arg) is frozenset:
- return cls.__public__.issuperset(arg)
- raise TypeError(
- "must be str, frozenset, or have frozenset '__public__' attribute"
- )
-
- @classmethod
- def implemented_by(cls, arg):
- """
- Return True if ``arg`` implements public interface of this class.
-
- This classmethod returns True if:
-
- 1. ``arg`` is an instance of or subclass of this class, and
-
- 2. ``arg`` (or ``arg.__class__`` if instance) has an attribute for
- each name in this class's ``__public__`` frozenset.
-
- Otherwise, returns False.
-
- Unlike `Plugin.implements`, this returns a concrete answer because
- the attributes of the subclass are checked.
-
- :param arg: An instance of or subclass of this class.
- """
- 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
-
def finalize(self):
"""
"""