becontrary.com is a neat site built with TurboGears

BeContrary.com is a very clever idea for a site. This debate on going dutch illustrates how the site works. And this is a good discussion of different styles of python templates.

The site’s author, Will McGugan, wrote up a blog post describing his experience with turbogears here. He says he chose TurboGears partially because he had already worked with CherryPy and really liked it. Will made this remark after talking about SQLObject:

Incidently, I don’t like the way that Python ORMs specify the database schema as Python code. Since the schema doesn’t change when the application is running, I would prefer a simple xml definition that would be used by the ORM to dynamically build classes for each table that could be derived from in the model code.

I like this idea, but instead of writing XML, I would prefer to write SQL and have python parse that to build classes.

Is TurboGears dying?

Popularity is not the best indicator of quality, but I don’t like this chart one bit:




I don’t like the dispatching system in turbogears

I wanted to translate a(1).b(2)into the TurboGears URL /a/1/b/2. A browser making a request for /a/1/b/2 would trigger that code.

This page explains how to do it. You build a single default method that catches everything and then does introspection to figure out where to send the request.

It works fine, but it isn’t nearly as obvious or concise as the regular-expression approach I’ve seen in rails and Django.

Ubuntu and TurboGears

It shouldn’t be so hard to set up turbogears on ubuntu Feisty Fox. The easy_install-2.4 turbogears approach crashes when trying to install Cheetah.

So, here’s a list of everything I had to do:

  • I installed the Ubuntu package for Cheetah: sudo apt-get install python-cheetah
  • Then I could run the easy install: sudo easy_install-2.4 turbogears
  • I edited /etc/apt/sources.list and added multiverse to the list of available packages. In other words, I changed this section:

deb http://archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://archive.ubuntu.com/ubuntu/ feisty universe

to look like this:

deb http://archive.ubuntu.com/ubuntu/ feisty universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ feisty universe multiverse

  • Then I installed the python profiler package: sudo apt-get install python-profiler.
  • I tried installing pysqlite2 through easy_install, but that blew up, so I installed ubuntu package for pysqlite2 instead: sudo apt-get install python-pysqlite2.

Now everything works.