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:

bool

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 or myplugin/__init__.py within the given plugin_dir.

Parameters:
  • plugin_name (str) – The name of the plugin.

  • plugin_dir (str) – The filesystem directory path where the plugin exists.

_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.

get_disabled_plugins()[source]

List of disabled plugins

get_enabled_plugins()[source]

List of plugins that are enabled (not necessary loaded yet).

get_loaded_plugins()[source]

List of plugins that have been loaded.

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 by App.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

load_plugins(plugin_list)[source]

Load a list of plugins. Each plugin name is passed to self.load_plugin().

Parameters:

plugin_list (list) – A list of plugin names to load.