__init__(self,
base_plugin_class,
plugin_package_module,
default_plugin_name=None,
fallback_plugin_name=None)
(Constructor)
| source code
|
Entropy Generic Plugin Factory constructor. MANDATORY: every plugin
module/package(name) must end with _plugin suffix.
Base plugin classes must have the following class attributes set:
-
BASE_PLUGIN_API_VERSION: integer describing API revision in use in
class
Subclasses of Base plugin class must have the following class
attributes set:
-
PLUGIN_API_VERSION: integer describing the currently implemented
plugin API revision, must match with BASE_PLUGIN_API_VERSION above
otherwise plugin won't be loaded and a warning will be printed.
Moreover, plugin classes must be "Python new-style classes",
otherwise parser won't be able to determine if classes have subclasses
and thus pick the proper object (one with no subclasses!!). See:
http://www.python.org/doc/newstyle -- in other words, you have to inherit
the built-in "object" class (yeah, it's called object). So,
even if using normal classes could work, if you start doing nasty things
(nested inherittance of plugin classes), behaviour cannot be guaranteed.
If it's not clear, let me repeat once again, valid plugin classes must
not have subclasses around! Think about it, it's an obvious thing.
If plugin class features a "PLUGIN_DISABLED" class attribute
with a boolean value of True, such plugin will be ignored.
- Parameters:
base_plugin_class (class) - Base EntropyPlugin-based class that valid plugin classes must
inherit from.
plugin_package_module (Python module) - every plugin repository must work as Python package, the value of
this argument must be a valid Python package module that can be
scanned looking for valid Entropy Plugin classes.
default_plugin_name (string) - identifier of the default plugin to load
fallback_plugin_name (string) - identifier of the fallback plugin to load if default is not
available
- Raises:
AttributeError - when passed plugin_package_module is not a valid Python package
module
|