Chapter 5. Plugins

Table of Contents
5.1. Setting PyBloxsom up to Use Plugins
5.2. Finding Plugins
5.3. Installing Plugins
5.4. Writing Your Own Plugins

PyBlosxom allows you to extend and augment its base functionality using PyBlosxom plugins. Plugins allow you to create additional variables; provide additional entry parsers, renderers, post-formatters, and pre-formatters; create new output data types; pull information from other non-blog sources; create images; and a variety of other things.

5.1. Setting PyBloxsom up to Use Plugins

There are two properties in your config.py file that affect the behavior for loading plugins.

The first one is the plugin_dirs property which is a list of strings specifying all the directories you might have plugins. For example:

Example 5-1. plugin_dirs variable value

py["plugin_dirs"] = ["/home/will/pybloxsom/plugins"]

This will cause PyBlosxom to look in this specific directory for plugins.

The other property is the load_plugins property. If you don't have this set at all (i.e. it's either not in the config.py file or the line is commented out), PyBlosxom will load all plugins it finds in the plugin directories you've specified and load them. It will look in each directory in order as you've specified. It will load the plugins in each directory in alphabetical order by filename.

The other way to load plugins is by specifying the plugins explicitly by setting the load_plugins property. PyBlosxom will load only the plugins you've specified and will load them in the order you've specified. The load_plugins property takes a list of strings. For example:

Example 5-2. load_plugins variable value

py["load_plugins"] = ["calendar", "category", "booklist"]

This will load the plugins whose filenames are calendar.py, category.py, and booklist.py. It will only load those plugins even if other plugins are in the directory and it will load them in that order.