Templating engine?

Daniel Ellison daniel at syrinx.net
Sat Jun 19 23:24:15 EDT 2004


Leif K-Brooks wrote:
> I'm planning to start on a fairly large web application, most likely 
> using mod_python. I recently wrote a fairly small (but real-world 
> useful) web app with it, and all of those req.write()s made for really 
> ugly code. Would a templating engine solve that? Does anyone have any 
> suggestions about which one to use?

I have a distaste for templating engines in general. I much prefer a 
complete separation of code from markup - or from any sort of 
presentation, for that matter. I would suggest using the effbot's 
ElementTree (http://effbot.org/zone/element.htm) or any other technology 
that allows you to treat the document as a set of Python objects which 
can then be written out as XHTML. This allows on-the-fly modification of 
the document even after designer-types have run it through Dreamweaver 
(for example), provided CSS is used to specify the presentation. With 
Cheetah (for example) there is no real chance for the template to load 
into an HTML editor for enhancement by a designer. Developers are 
notoriously not graphics specialists...

This may not be as important to a small, personal project, but it really 
makes a difference in a "fairly large web application". You'll come to 
appreciate the freedom this approach affords in modifying the graphics 
without having to fire up your development environment, and in enhancing 
the code without having to think about the presentation.

Daniel Ellison



More information about the Python-list mailing list