HTML generation vs PSP vs Templating Engines

riplin at Azonic.co.nz riplin at Azonic.co.nz
Sat Nov 19 16:31:00 EST 2005


> No templates, no python-like or special languages, only pure and simple python.

> You can embedd python into html or, if it better suits your programming
> style, you can embed html into python. Why don't you give it a try?

I dislike embedding code or html in each other, apart from the
'impurity' of mixing code and user interface it makes them inseparable.

Using templates means that the code can work with different templates,
and this should be seamless, it also means that different code can be
used with the templates, for example if different languages are used.

The main advantage, for me, is that different outputs formats can be
created without changing the code. If the user wants a set of data in a
table then the html template is used, if they want a csv file of the
data, that is just a different template name.  A printed report: same
code just a different template name. XML, simple text, postscript,
EDIFACT file, all done with same code, different template. Just arrange
for the name of the template file to be a parameter on the URL and the
various outputs can be selected by the user.

I did, however, write my own templating module, they are quite easy to
do.




More information about the Python-list mailing list