Differences between Constrictor and Blosxom

Constrictor follows the basic design of Blosxom very closely, down to the structure of the code. However, both due to the differences between Perl and Python and my own personal feelings, there are some differences between the two systems. If you have existing Blosxom plugins you wish to port, this should be useful as a guide for what changed.

All useful variables are held in the state dictionary, which is passed to all plugin callbacks. Python doesn't allow access to arbitrary variables in the enclosing scope in the same way that Perl does, nor does it allow passing variables by reference, so in order to allow modification of arbitrary values, they are kept in a single dictionary that is passed to all plugins. As a result, all plugins callbacks have the same signature, taking only the state dictionary.

Plugins must be named with a .py extension. Not only does this make it unambiguous which plugins are in use, but it fits with the general naming scheme of Python modules in general, and it makes the .pyc compiled versions that Python automatically generates more understandable.

Template variable substitution should be written in Python dictionary substitution format. For instance, instead of writing <a href="$url/test.html"> you would write <a href="%(url)s/test.html">.

The start method should return an object representing the plugin, or None to be disabled. The object should have callable members for each callback the plugin implements. In theory, this should allow more flexibility and an easier migration path towards making Constrictor threadsafe in the future. Plugin local variables should be stored either in object members or in the state dictionary with a name prefixed with the plugin name. See the sample plugins for some examples.

Several common variables are named or typed differently. For example, static, a boolean, instead of static_or_dynamic, a string; and category, a list, instead of path_info, a string.

I use American spelling. In particular, you'll see flavor instead of flavour.