Template plugins for everyone!
Jan 6, 2006 18:26 · 196 words · 1 minute read
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.