cement.ext.ext_plugin
Cement plugin extension module.
- class cement.ext.ext_plugin.CementPluginHandler[source]
Bases:
PluginHandlerThis class is an internal implementation of the IPlugin interface. It does not take any parameters on initialization.
- _load_plugin_from_bootstrap(plugin_name: str, base_package: str) bool[source]
Load a plugin from a python package. Returns True if no ImportError is encountered.
- Parameters:
- Returns:
Trueis the plugin was loaded,Falseotherwise.- Return type:
- Raises:
ImportError – If the plugin can not be imported
- _load_plugin_from_dir(plugin_name: str, plugin_dir: str) bool[source]
Load a plugin from a directory path rather than a python package within sys.path. This would either be
myplugin.pyormyplugin/__init__.pywithin the givenplugin_dir.
- _setup(app_obj: App) None[source]
Called during application initialization and must
setupthe handler object making it ready for the framework or the application to make further calls to it.- Parameters:
app (instance) – The application object.
- get_enabled_plugins() List[str][source]
List of plugins that are enabled (not necessary loaded yet).
- load_plugin(plugin_name: str) None[source]
Load a plugin whose name is
plugin_name. First attempt to load from a plugin directory (plugin_dir), secondly attempt to load from a Python module determined byApp.Meta.plugin_module.Upon successful loading of a plugin, the plugin name is appended to the
self._loaded_plugins list.- Parameters:
plugin_name (str) – The name of the plugin to load.
- Raises:
cement.core.exc.FrameworkError – If the plugin can not be loaded