Barghest is the (still mythical, but becoming less so) content management system for ghilbert.org.
The code is written in Python, and is intended to be simple yet powerful. As of 27 Dec 2006, it is 626 lines of code, and not very dense at that. Of that, 100 lines is the wikiformat() function, which takes a big string of WikiMarkup and renders XHTML into the ctx.
It should be pretty easy to read the code, but here is a top-level roadmap. A query begins by instantiating a ctx object. The path_info, path_l, and query fields represent the slightly parsed url and query data. Content is written into the response using the header() and write() methods on the ctx. The ctx object also references a connection to the database as well as information for user authentication. This is all very similar to web.py, from which considerable inspiration was drawn. One difference is that the ctx is explicitly passed around, rather than appearing as a global which "magically" acts like it's a different object in each thread.
The dispatch to a handler is dead simple. The run() method just follows the servtab data structure until it reaches a function rather than a dict, and it calls that function with a ctx. The actual work of serving pages is done in functions named serve_foo().
The content is stored in a log (see the AsteroidMeta page for more details), and retrieving the most revent version of something is done in by SQL query logic.
Patches are likely to be accepted, especially for stuff like RSS feeds, image uploads, and other essentials. The main thing I ask is to keep things simple. I'm not a big fan of abstraction layers just for the sake of abstraction. Of course, if adding an abstraction really makes the code simpler and more powerful, I'm all for it.
Dan Getz has adapted the initial Barghest codebase into the Django framework, and the result is called Ghestalt. I've checked in the most recent changes to Barghest, including very basic theorem display and improvements to the markup formatter. The next step will be to merge those changes into the Ghestalt codebase, then get the Ghestalt instance running on the ghilbert.org server.
See also the Barghest page on the WikiCreole wiki.
Last edited 2007-01-01 11:22:16 by Raph Levien