Genshi Tutorial

5 September 2007
17:32

Genshi has pretty good reference documentation (if I may say so myself), but what was missing was something that would walk you through creating an application that uses Genshi, pointing out best practices and the like. All of the examples that came with Genshi were very basic, and the only other option for learning the library was to study the code of an application that uses it, such as Trac or Posterity. But in general, real-world applications are just too complex to be helpful in this respect.

So last week, after Michael Schurter pointed out this glaring hole in Genshi's plans for world dominance, I started putting together a tutorial on how you'd use Genshi in a web-app. And today the finishing touches have been put on it.

The tutorial guides you through the process of building a (very) stripped down version of reddit.com, dubbed “geddit?”. It uses CherryPy for the HTTP, FormEncode for the validation, and, well, Genshi for the output. To keep things simple, there's no ORM or SQL; instead persistence is implemented using pickle, i.e. native Python serialization.

I believe the tutorial has turned out pretty nicely. Using a simple application, it conveys a good number of usage patterns and best practices, and not necessarily limited to Genshi: it should also be a good read for anyone interested in CherryPy, and even Python and/or web development in general.