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>
pull/14976/head
夏恺(Xia Kai) 9 years ago
parent b33074b703
commit cd6d865e27

@ -329,7 +329,7 @@ class PluginLoader:
obj = getattr(self._module_cache[path], self.class_name) obj = getattr(self._module_cache[path], self.class_name)
else: else:
obj = getattr(self._module_cache[path], self.class_name)(*args, **kwargs) 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 None
return obj return obj

Loading…
Cancel
Save