cement.core.extension

Cement core extensions module.

class cement.core.extension.ExtensionHandler(**kw)[source]

Bases: ExtensionInterface, Handler

This handler implements the Extention Interface, which handles loading framework extensions. All extension handlers should sub-class from here, or ensure that their implementation meets the requirements of this base class.

class Meta[source]

Bases: object

Handler meta-data (can be passed as keyword arguments to the parent class).

label = 'cement'

The string identifier of the handler.

get_loaded_extensions()[source]

Get all loaded extensions.

Returns:

A list of loaded extensions.

Return type:

list

list()[source]

Synonymous with get_loaded_extensions().

Returns:

A list of loaded extensions.

Return type:

list

load_extension(ext_module)[source]

Given an extension module name, load or in other-words import the extension.

Parameters:

ext_module (str) – The extension module name. For example: cement.ext.ext_logging.

Raises:

cement.core.exc.FrameworkError – Raised if ext_module can not be loaded.

load_extensions(ext_list)[source]

Given a list of extension modules, iterate over the list and pass individually to self.load_extension().

Parameters:

ext_list (list) – A list of extension module names (str).

class cement.core.extension.ExtensionInterface(**kw)[source]

Bases: Interface

This class defines the Extension Interface. Handlers that implement this interface must provide the methods and attributes defined below. In general, most implementations should sub-class from the provided ExtensionHandler base class as a starting point.

class Meta[source]

Bases: object

Handler meta-data.

interface = 'extension'

The string identifier of the interface.

abstract load_extension(ext_module)[source]

Load an extension whose module is ext_module. For example, cement.ext.ext_json.

Parameters:

ext_module (str) – The name of the extension to load

abstract load_extensions(ext_list)[source]

Load all extensions from ext_list.

Parameters:

ext_list (list) – A list of extension modules to load. For example: ['cement.ext.ext_json', 'cement.ext.ext_logging']