Use only classes defined in the plugin when loading it.
A fat-free DIY Python plugin management toolkit.
Brought to you by:
tibonihoo
This change will allow plugins to subclass other plugins. The way we
currently look for elements by looking in dir(candidate_module)
instantiates the wrong element, if we imported something from a
different plugin, to subclass it.
Anonymous
Hi,
I only have time for a quick answer, so first of al thanks for the patch !
If you have the time, could you propose some code for a unit-test that would show the incorrect behaviour of yapsy in the case you described ?
If not I'll do it, but I may not have the occasion to work on it very soon.
I'll try to add one, soon. Thanks!
Also, is there a reason, you use tabs everywhere in your code, instead of spaces? Just asking.
After trying a little this idea, it seems we may fall in some corner cases when the "plugin_module_name" is not a python file but a directory.
It may then happen than the module name is not exactly the plugin_module_name (a little import * in the module's init.py can lead to this easily).
Maybe this could work pretty well with a module.startswith(plugin_module_name), but I'd rather take a little more reflexion on this subject. It's currently a known and documented limitation of yapsy so there isn't a big hurry.
See also a related bug report [bugs:#16]
Related
Bugs: #16
Last edit: Thibauld Nion 2014-05-31