From 3495c67d57868a02bafe6f1935d4846cd5615bf5 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sat, 9 Aug 2008 01:46:12 +0000 Subject: 94: Renamed Proxy._clone() method to Proxy.__clone__(); updated unit tests --- ipalib/plugable.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ipalib/plugable.py') diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 1e1f4a90..c5ec08ec 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -139,6 +139,14 @@ class Proxy(ReadOnly): def implements(self, arg): return self.__base.implements(arg) + def __clone__(self, name_attr): + """ + Returns a Proxy instance identical to this one except the proxy name + might be derived from a different attribute on the target. The same + base and target will be used. + """ + return self.__class__(self.__base, self.__target, name_attr) + def __iter__(self): """ Iterates (in ascending order) though the attribute names this proxy is @@ -168,8 +176,6 @@ class Proxy(ReadOnly): def __call__(self, *args, **kw): return self['__call__'](*args, **kw) - def _clone(self, name_attr): - return self.__class__(self.__base, self.__target, name_attr) def __repr__(self): return '%s(%s, %r, %r)' % ( -- cgit