summaryrefslogtreecommitdiffstats
path: root/ipalib/plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-09 18:58:46 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-09 18:58:46 +0000
commit5315514f6c773de897c2e74a4ad31bbfeeae2bda (patch)
treefe48bebc096048daac55539c363066d57be1e2bc /ipalib/plugable.py
parent9712eae51ce072962a7e969684ba9e8b4ec19dd9 (diff)
downloadfreeipa.git-5315514f6c773de897c2e74a4ad31bbfeeae2bda.tar.gz
freeipa.git-5315514f6c773de897c2e74a4ad31bbfeeae2bda.tar.xz
freeipa.git-5315514f6c773de897c2e74a4ad31bbfeeae2bda.zip
98: Completed docstrings in Proxy
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r--ipalib/plugable.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 2bef3de7..7a571995 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -176,6 +176,13 @@ class Proxy(ReadOnly):
self.__lock__()
def implements(self, arg):
+ """
+ Returns True if this proxy implements `arg`. Calls the corresponding
+ classmethod on ProxyTarget.
+
+ Unlike ProxyTarget.implements(), this is not a classmethod as a Proxy
+ only implements anything as an instance.
+ """
return self.__base.implements(arg)
def __clone__(self, name_attr):
@@ -196,8 +203,8 @@ class Proxy(ReadOnly):
def __getitem__(self, key):
"""
- If this proxy allowes access to an attribute named `key`, return that
- attrribute.
+ If this proxy allows access to an attribute named `key`, return that
+ attribute.
"""
if key in self.__public__:
return getattr(self.__target, key)
@@ -205,18 +212,25 @@ class Proxy(ReadOnly):
def __getattr__(self, name):
"""
- If this proxy allowes access to an attribute named `name`, return that
- attrribute.
+ If this proxy allows access to an attribute named `name`, return that
+ attribute.
"""
if name in self.__public__:
return getattr(self.__target, name)
raise AttributeError('no proxy attribute %r' % name)
def __call__(self, *args, **kw):
+ """
+ Attempts to call target.__call__(); raises KeyError if `__call__` is
+ not an attribute this proxy allows access to.
+ """
return self['__call__'](*args, **kw)
-
def __repr__(self):
+ """
+ Returns a Python expression that could be used to construct this Proxy
+ instance given the appropriate environment.
+ """
return '%s(%s, %r, %r)' % (
self.__class__.__name__,
self.__base.__name__,