cement.ext.ext_plugin
Cement plugin extension module.
- class cement.ext.ext_plugin.CementPluginHandler[source]
Bases:
PluginHandler
This class is an internal implementation of the IPlugin interface. It does not take any parameters on initialization.
- class Meta[source]
Bases:
object
Handler meta-data.
- label = 'cement'
The string identifier for this class.
- _load_plugin_from_bootstrap(plugin_name, base_package)[source]
Load a plugin from a python package. Returns True if no ImportError is encountered.
- Parameters:
plugin_name (str) – The name of the plugin, also the name of the module to load from base_package. I.e.
myapp.bootstrap.myplugin
base_package – The base python package to load the plugin module from. I.e.
myapp.bootstrap
or similar.
- Returns:
True
is the plugin was loaded,False
otherwise- Return type:
- Raises:
ImportError – If the plugin can not be imported
- _load_plugin_from_dir(plugin_name, plugin_dir)[source]
Load a plugin from a directory path rather than a python package within sys.path. This would either be
myplugin.py
ormyplugin/__init__.py
within the givenplugin_dir
.
- _setup(app_obj)[source]
Called during application initialization and must
setup
the handler object making it ready for the framework or the application to make further calls to it.- Parameters:
app (instance) – The application object.
- load_plugin(plugin_name)[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