I have been massive underwhelmed by the traversal mechanism of CherryPy, which is used in TurboGears.
If you are building a large complex application, you need a lot of control over traversal, and CherryPy just doesn’t give you this. URL components have to be fixed for the normal traversal mechanisms to work. If you want them to be variable, then you need to write some pretty hairy code that depends a lot on CherryPy internals.
In my view this is the major failing in the application, which is otherwise pretty nice. I’ll moan about the lack of daemonisation another time
The other major option is to use Routes. This is lifted from Rails. I gave this a go, but I really dislike pretty much everything about it – I don’t think regular expressions are part of the mix to solve an architectural problem like this.
So, enter TGNewTraversal. I’ve ripped off some of the code from Nevow’s traversal mechanism, which is the best I’ve seen anywhere. I’ve tweaked this slightly to be more friendly in the CherryPy environment. The tiny amount of code required is a testimony to the quality of the traversal concept from Nevow.
It’s working very well on a development project I’m working on right now, and seems ready for an Alpha release at least. It’s released under a BSD license and is in the Cheese Shop. Please give it a shot and let me know what you think.

Recent comments