diff options
-rw-r--r-- | ipalib/plugable.py | 9 | ||||
-rw-r--r-- | ipalib/tests/test_plugable.py | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index fe4a4531..4a790a37 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -131,7 +131,6 @@ class Proxy(ReadOnly): """ __slots__ = ( - '__call__', '__obj', 'name', ) @@ -145,10 +144,10 @@ class Proxy(ReadOnly): check_identifier(proxy_name) object.__setattr__(self, '_Proxy__obj', obj) object.__setattr__(self, 'name', proxy_name) - if callable(obj): - object.__setattr__(self, '__call__', obj.__call__) - #for name in self.__slots__: - # object.__setattr__(self, name, getattr(obj, name)) + for name in self.__slots__: + attr = getattr(obj, name) + if callable(attr): + object.__setattr__(self, name, attr) def __repr__(self): return '%s(%r)' % (self.__class__.__name__, self.__obj) diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index 6ca4050b..ab9a8665 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -62,6 +62,9 @@ def test_valid_identifier(): def test_Plugin(): + cls = plugable.Plugin + assert type(cls.name) is property + api = 'the api instance' p = plugable.Plugin() assert read_only(p, 'name') == 'Plugin' |