Newsbruiser Technical Overview

Leonard Richardson <leonardr@segfault.org>
Version: 1.0

Object Model

NewsBruiser is built around three basic concepts: the Notebook, the Entry, and the EntryID.

Core Classes

There are three core classes which support the object model and the CGIs.

CGIs and SSIs

Each of the five CGIs (covered in the intro doc) implements an __init__ method which specifies the page title and any special data to be collected from CGI variables, and a run method which makes changes and/or renders an HTML page. Each is implemented as a class which is instantiated and run when the CGI file is run as a script.

The SSIs are simpler, having only a main function which gets some specified Entry objects and prints them out in some way.

Helper Modules

There are five helper modules, each of which is used by multiple classes.

.firstEntry

Every non-empty notebook will soon sprout a .firstEntry file in its top-level directory. This file contains the slash-separated identifier of the first entry in that notebook. .firstEntry is used as a cache, since on a site with several years worth of entries, the date of the first entry takes a while to calculate. The date of the first entry is needed by ControlPanel, so that "previous" links are not shown if following them would lead you before the first entry in the notebook.

If the first entry changes (because you import old entries, for instance), you'll need to delete the .firstEntry file or your older entries won't be linked to from CGIs (but you'll still see them if you hit their URLs).

Extending NewsBruiser

Since most methods have access to a Notebook object, it's likely that anything you add to the .nbrc configuration will be accessible from the method where you need it, so changing method signatures should not be neccessary for small changes, or possibly even large changes like the addition of user accounts.

The API should be complete enough that writing additional CGIs and SSIs will be fairly easy (see today_in_history.ssi for an example of a rather complex SSI).


Back to the main documentation