Iteration 3: Plugins for Plugins

From about November 27th to December 2nd, I was sprinting over a new branch/version of the webfront for PyBlosxom that I have dubbed Iteration 3 (as its branch name on launchpad). It uses some code from the original webfront code base (namely the SessionControl object). But a lot of the core functions (saving, authenticating, session handling, template rendering, views) have to be implemented by callbacks that are called using PyBlosxom's callback facility.

The current callbacks in the core system are:

  1. wf_save - saves a entry to the datadir
  2. wf_authenticate - authenticate a username and password
  3. wf_session - manage session information
  4. wf_page - handling a query and form data and spitting out a response
  5. wf_render - rendering a template for a page

Iteration 3 provides a base/default implementation for these callbacks along with some useful functions in a tools package. But leaves plenty of room for improvement through additional plugins. Or you could modify how it works.

You can change how authentication works. Maybe instead of using a config variable to save your authentication information, you want to use OpenID or maybe you want to check the information against the local operating system. Write a plugin with a wf_authenticate callback using the method you want and there you go.

You can change how files save or how sessions are tracked. You can use a different template engine, or different templates. You can change how a page is handled.

What I think is potentially the best part is adding new pages.

Some ideas of mine:

Another idea I am hoping to do at a later time is look for/make a plugin to allow looking through a source repository as my datadir for old versions of a file and have those available. This plugin would also include callbacks for the webfront to save and commit changes to files. Which brings up thoughts improving methods for how the webfront reads files, whether it uses preexisting callbacks or a new one.

I have posted this initial sprint in a branch on launchpad next to its elder brethren at https://code.launchpad.net/~zera-goddard/pyblosxom-webfront/iteration3. For the time being, I will have to wait before I mess more in this branch. I like the resulting code so far but I have many criticism of many parts of my own already written down.

I have also played with using a few widely available javascripts (jquery & jquery.growfield) to make using the textarea in the editing page better. But I have not published that (partly because it takes five lines in the templates and inclusion of the forementioned in the templates folder).

More to do, so little time.

posted at: Mon, 07 Dec 2009 00:45 | path: /software/webfront | permanent link to this entry