Author: Rafael Valverde ([email protected])
Cacilda’s a Python application of WSGI protocol that implements a web-based wiki software and is powered by the non-relational database Cassandra.
Out-of-box, it offers a simple wiki system, with no authentication, logging or caching engines. Those should be implemented as middleware software without great efforts.
Because the fashion Cacilda was thought and coded – being minimal and relying the less on third-party libraries – it was necessary to reinvent the wheel at some extent,
e.g., some boilerplate code was introduced like those needed to handle POST’s variables.
Versioning system was designed to accomplish minimal storage footprint and as so it was coded using difflib module to persists only modified lines and its contexts yet being totally reversible.
All previous versions from a particular article is saved as a delta, i.e., a text-based file that keeps track of every change made. The delta snippets are relative to the newer and most adjacent change so if you want to go three versions back, you need to gradually reverse one by one.
The reason for that is that reversing changes doesn’t occur very often as getting the current version of an article. The exchange seems to be worthwhile.
Update: In fact, using difflib to track down modifications turned out to be a bad decision since the library saves all data from the two versions that are being compared in order to be able to revert any changes.
The Template class is a very simple wrapper to the standard library string.Template. I opted not to make it a function to keep things namespaced.
As a general comment, I’d like to state Cacilda is a first attempt towards learning about Cassandra and was made in a rush between readings. Don’t expect too much from the code regarding modularization or general reuse principles.
Its main purpose is to provide a concise and ready to use wiki.
- lazyboy module: an abstraction layer to ThriftInterface that interfaces Cassandra
- textile module: an implementation of Textile markup language
- Python’s standard libraries such as mimetypes, urlparse, cgi and difflib
- Make an exception from Cacilda.not_found method so it could be easily raised from anywhere (middleware apps);
- Implement a verison control system – currently it’s only saving an article history, there’s no way to revert versions or something alike from interface;
- Implement a simple auth middleware;
- Abstract routing routines. Currently it’s tightly coupled to the app – actually, it’s hardcoded into Cacilda class;
- Load database configuration from a file;
- Document code and write down some tests.
The following storage-conf.xml schema is assumed when you use Cacilda:
<Keyspaces>
<Keyspace Name="Cacilda">
<ColumnFamily CompareWith="UTF8Type"
Name="wiki"
FlushPeriodInMinutes="60"/>
<ColumnFamily CompareWith="UTF8Type"
Name="wiki_history"
FlushPeriodInMinutes="60"/>
</Keyspace>
</Keyspaces>