1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

use __mro__ for plugin loading when we search for its base class.

This would relax the constraint a little bit, allowing subclassing existing plugins.

Signed-off-by: 夏恺(Xia Kai) <xiaket@gmail.com>
This commit is contained in:
夏恺(Xia Kai) 2016-03-15 10:01:31 +00:00
parent b33074b703
commit cd6d865e27

View file

@ -329,7 +329,7 @@ class PluginLoader:
obj = getattr(self._module_cache[path], self.class_name)
else:
obj = getattr(self._module_cache[path], self.class_name)(*args, **kwargs)
if self.base_class and self.base_class not in [base.__name__ for base in obj.__class__.__bases__]:
if self.base_class and self.base_class not in [base.__name__ for base in obj.__class__.__mro__]:
return None
return obj