Package Pyblosxom :: Module plugin_utils
[show private | hide private]
[frames | no frames]

Module Pyblosxom.plugin_utils

Holds a series of utility functions for cataloguing, retrieving, and manipulating callback functions and chains. Refer to the documentation for which callbacks are available and what their behavior is.
Function Summary
  catalogue_plugin(plugin_module)
Goes through the plugin's contents and catalogues all the functions that start with cb_.
list of functions get_callback_chain(chain)
Returns a list of functions registered with the callback.
string get_module_name(filename)
Takes a filename and returns the module name from the filename.
Python module get_plugin_by_name(name)
This retrieves a plugin instance (it's a Python module instance) by name.
list of strings get_plugin_list(plugin_list, plugin_dirs)
This handles the situation where the user has provided a series of plugin dirs, but has not specified which plugins they want to load from those dirs.
  initialize_plugins(plugin_dirs, plugin_list)
Imports and initializes plugins from the directories in the list specified by "plugins_dir".

Variable Summary
str __revision__ = '$Id: plugin_utils.py,v 1.10 2005/12/09 0...
dict callbacks = {}
list plugins = []

Function Details

catalogue_plugin(plugin_module)

Goes through the plugin's contents and catalogues all the functions that start with cb_. Functions that start with cb_ are callbacks.
Parameters:
plugin_module - the module to catalogue
           (type=module)

get_callback_chain(chain)

Returns a list of functions registered with the callback.
Returns:
list of functions registered with the callback (or an empty list)
           (type=list of functions)

get_module_name(filename)

Takes a filename and returns the module name from the filename.

Example: passing in "/blah/blah/blah/module.ext" returns "module"
Returns:
the filename without path or extension
           (type=string)

get_plugin_by_name(name)

This retrieves a plugin instance (it's a Python module instance) by name.
Parameters:
name - the name of the plugin to retrieve (ex: "xmlrpc")
           (type=string)
Returns:
the Python module instance for the plugin or None
           (type=Python module)

get_plugin_list(plugin_list, plugin_dirs)

This handles the situation where the user has provided a series of plugin dirs, but has not specified which plugins they want to load from those dirs. In this case, we load all possible plugins except the ones whose names being with _ .
Parameters:
plugin_list - List of plugins to load
           (type=list or None)
plugin_dirs - A list of directories where plugins can be loaded from
           (type=list)
Returns:
list of python module names of the plugins to load
           (type=list of strings)

initialize_plugins(plugin_dirs, plugin_list)

Imports and initializes plugins from the directories in the list specified by "plugins_dir". If no such list exists, then we don't load any plugins.

If the user specifies a "load_plugins" list of plugins to load, then we explicitly load those plugins in the order they're listed. If the load_plugins key does not exist, then we load all the plugins in the plugins directory using an alphanumeric sorting order.
Parameters:
plugin_dirs - the list of directories to add to the sys.path because that's where our plugins are located.
           (type=list of strings)
plugin_list - the list of plugins to load, or if None, we'll load all the plugins we find in those dirs.
           (type=list of strings or None)

Variable Details

__revision__

Type:
str
Value:
'$Id: plugin_utils.py,v 1.10 2005/12/09 05:07:57 willhelm Exp $'       

callbacks

Type:
dict
Value:
{}                                                                     

plugins

Type:
list
Value:
[]                                                                     

Generated by Epydoc 2.1 on Tue Feb 7 21:43:57 2006 http://epydoc.sf.net