Template plugins for everyone!

A few days ago, I mentioned that TurboGears 0.9 (currently in svn only) now supports template plugins with four available (Cheetah, Stan, ZPT, plus Kid which was built in to TurboGears). Meanwhile, Buffet (a template rendering filter for CherryPy) supports Cheetah, CherryTemplate, Kid, Myghty, Python String Templates and XSLT. Not only that, Buffet used a very similar pattern for choosing a template and sending data to it.

So, I emailed Christian Wyglendowski about it… and we settled on an interface for our template plugins. I just checked in the code to make this work in TurboGears, plus new TurboKid and TurboCheetah plugins to match. When Christian updates Buffet, it will automatically be able to use these plugins.

The really cool thing here is that these plugins only depend on their template engines. They don’t require TurboGears, Buffet or CherryPy to use them.

All of this is made not just possible but easy through setuptools entry_points. I’ve updated the documentation on the TurboGears site to reflect the new interface for anyone that wants to create a plugin.

Also, if you’re interested in taking over the Cheetah plugin, I (and everyone using Cheetah with TurboGears) would appreciate that.


3 Responses to “Template plugins for everyone!”

Manuzhai on January 9th, 2006 11:42 am:

Is the interface published anywhere? I’ve been thinking long and hard about this, and am very interested in what you’ve come up with!


tazzzzz on January 11th, 2006 11:33 am:

The interface right now is very simple and based on how TurboGears does things. It’s certainly open for expansion, if need be!

http://www.turbogears.org/docs/plugins/template.html


Floating Sun » Turbogears rocks on February 17th, 2006 4:40 am:

[...] So far I haven’t touched Mochikit at all, and barely scratched the surface of Kid and CherryPy, but with my experiences so far, I’m really looking forward to digging deeper. A comforting thought is that TG is highly flexible in terms of the components – people have used SQLAlchemy instead of SQLObjects, there are template plugins for Cheetah, Stan etc. So if I don’t enjoy this particular combination for some reason, I can atleast hope that my efforts into learning TG will not go to waste – something or the other will work out Tags [...]