mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Removed Plugin.doc property and replaced with instance attribute created in Plugin.__init__()
This commit is contained in:
parent
69041c3b1b
commit
171ed58367
@ -258,17 +258,11 @@ class Plugin(ReadOnly):
|
|||||||
self.name = cls.__name__
|
self.name = cls.__name__
|
||||||
self.module = cls.__module__
|
self.module = cls.__module__
|
||||||
self.fullname = '%s.%s' % (self.module, self.name)
|
self.fullname = '%s.%s' % (self.module, self.name)
|
||||||
|
self.doc = cls.__doc__
|
||||||
log = logging.getLogger('ipa')
|
log = logging.getLogger('ipa')
|
||||||
for name in ('debug', 'info', 'warning', 'error', 'critical'):
|
for name in ('debug', 'info', 'warning', 'error', 'critical'):
|
||||||
setattr(self, name, getattr(log, name))
|
setattr(self, name, getattr(log, name))
|
||||||
|
|
||||||
def __get_doc(self):
|
|
||||||
"""
|
|
||||||
Convenience property to return the class docstring.
|
|
||||||
"""
|
|
||||||
return self.__class__.__doc__
|
|
||||||
doc = property(__get_doc)
|
|
||||||
|
|
||||||
def __get_api(self):
|
def __get_api(self):
|
||||||
"""
|
"""
|
||||||
Return `API` instance passed to `finalize()`.
|
Return `API` instance passed to `finalize()`.
|
||||||
|
@ -303,7 +303,6 @@ class test_Plugin(ClassChecker):
|
|||||||
"""
|
"""
|
||||||
assert self.cls.__bases__ == (plugable.ReadOnly,)
|
assert self.cls.__bases__ == (plugable.ReadOnly,)
|
||||||
assert self.cls.__public__ == frozenset()
|
assert self.cls.__public__ == frozenset()
|
||||||
assert type(self.cls.doc) is property
|
|
||||||
assert type(self.cls.api) is property
|
assert type(self.cls.api) is property
|
||||||
|
|
||||||
def test_init(self):
|
def test_init(self):
|
||||||
@ -314,20 +313,20 @@ class test_Plugin(ClassChecker):
|
|||||||
assert o.name == 'Plugin'
|
assert o.name == 'Plugin'
|
||||||
assert o.module == 'ipalib.plugable'
|
assert o.module == 'ipalib.plugable'
|
||||||
assert o.fullname == 'ipalib.plugable.Plugin'
|
assert o.fullname == 'ipalib.plugable.Plugin'
|
||||||
|
assert o.doc == self.cls.__doc__
|
||||||
class some_subclass(self.cls):
|
class some_subclass(self.cls):
|
||||||
pass
|
"""
|
||||||
|
Do sub-classy things.
|
||||||
|
|
||||||
|
Although it doesn't know how to comport itself and is not for mixed
|
||||||
|
company, this class *is* useful as we all need a little sub-class
|
||||||
|
now and then.
|
||||||
|
"""
|
||||||
o = some_subclass()
|
o = some_subclass()
|
||||||
assert o.name == 'some_subclass'
|
assert o.name == 'some_subclass'
|
||||||
assert o.module == __name__
|
assert o.module == __name__
|
||||||
assert o.fullname == '%s.some_subclass' % __name__
|
assert o.fullname == '%s.some_subclass' % __name__
|
||||||
|
assert o.doc == some_subclass.__doc__
|
||||||
def test_doc(self):
|
|
||||||
"""
|
|
||||||
Test the `ipalib.plugable.Plugin.doc` property.
|
|
||||||
"""
|
|
||||||
class some_subclass(self.cls):
|
|
||||||
'here is the doc string'
|
|
||||||
assert read_only(some_subclass(), 'doc') == 'here is the doc string'
|
|
||||||
|
|
||||||
def test_implements(self):
|
def test_implements(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user