Back to index

obnam  1.1
Public Member Functions
obnamlib.pluginmgr.Plugin Class Reference
Inheritance diagram for obnamlib.pluginmgr.Plugin:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def name
def description
def version
def required_application_version
def enable_wrapper
def disable_wrapper
def enable
def disable

Detailed Description

Base class for plugins.

A plugin MUST NOT have any side effects when it is instantiated.
This is necessary so that it can be safely loaded by unit tests,
and so that a user interface can allow the user to disable it,
even if it is installed, with no ill effects. Any side effects
that would normally happen should occur in the enable() method,
and be undone by the disable() method. These methods must be
callable any number of times.

The subclass MAY define the following attributes:

* name
* description
* version
* required_application_version

name is the user-visible identifier for the plugin. It defaults
to the plugin's classname.

description is the user-visible description of the plugin. It may
be arbitrarily long, and can use pango markup language. Defaults
to the empty string.

version is the plugin version. Defaults to '0.0.0'. It MUST be a
sequence of integers separated by periods. If several plugins with
the same name are found, the newest version is used. Versions are
compared integer by integer, starting with the first one, and a 
missing integer treated as a zero. If two plugins have the same 
version, either might be used.

required_application_version gives the version of the minimal 
application version the plugin is written for. The first integer
must match exactly: if the application is version 2.3.4, the
plugin's required_application_version must be at least 2 and
at most 2.3.4 to be loaded. Defaults to 0.

Definition at line 33 of file pluginmgr.py.


Member Function Documentation

Definition at line 79 of file pluginmgr.py.

00079 
00080     def description(self):
00081         return ''
        
Disable the plugin.

Definition at line 111 of file pluginmgr.py.

00111 
00112     def disable(self):
00113         '''Disable the plugin.'''
00114         raise NotImplemented()
00115 

Here is the caller graph for this function:

Corresponds to enable_wrapper, but for disabling a plugin.

Definition at line 103 of file pluginmgr.py.

00103 
00104     def disable_wrapper(self):
00105         '''Corresponds to enable_wrapper, but for disabling a plugin.'''
00106         self.disable()
    

Here is the call graph for this function:

Enable the plugin.

Definition at line 107 of file pluginmgr.py.

00107 
00108     def enable(self):
00109         '''Enable the plugin.'''
00110         raise NotImplemented()
    

Here is the caller graph for this function:

Enable plugin.

The plugin manager will call this method, which then calls the
enable method. Plugins should implement the enable method.
The wrapper method is there to allow an application to provide
an extended base class that does some application specific
magic when plugins are enabled or disabled.

Definition at line 90 of file pluginmgr.py.

00090 
00091     def enable_wrapper(self):
00092         '''Enable plugin.
00093         
00094         The plugin manager will call this method, which then calls the
00095         enable method. Plugins should implement the enable method.
00096         The wrapper method is there to allow an application to provide
00097         an extended base class that does some application specific
00098         magic when plugins are enabled or disabled.
00099         
00100         '''
00101         
00102         self.enable()

Here is the call graph for this function:

Definition at line 75 of file pluginmgr.py.

00075 
00076     def name(self):
00077         return self.__class__.__name__
        

Definition at line 87 of file pluginmgr.py.

00087 
00088     def required_application_version(self):
00089         return '0.0.0'
        

Definition at line 83 of file pluginmgr.py.

00083 
00084     def version(self):
00085         return '0.0.0'
        

The documentation for this class was generated from the following file: