bag.web.pyramid.plugins_manager module¶
Manage plugins for your Python software.
- class bag.web.pyramid.plugins_manager.PluginsManager(settings)[source]¶
Bases:
object
- call(method, args=[], kwargs={}, only_enabled_plugins=True)[source]¶
Generic method that calls some method in the plugins.
- enabled¶
- bag.web.pyramid.plugins_manager.find_subclasses(cls, path)[source]¶
Find subclasses of cls in .py files located below path.
(This does look in subdirectories).
Usage:
classes = find_subclasses(BasePlugin, "pluginsfolder")
@param cls: the base class that all subclasses should inherit from @type cls: class @param path: the path to the top level directory to walk @type path: str @rtype: list @return: a list if classes that are subclasses of cls
Stolen from http://www.luckydonkey.com/2008/01/02/python-style-plugins-made-easy/
This could be improved by using cls.__subclasses__(), however this only returns the immediate subclasses.