Login to your account |
Other Options |

There are a number of (very good) templating systems and languages available for Python. They fall in to one of two camps; either they are XML based, like Genshi, or they are text based, like Mako. Most programmers favour one or the other, but there is far from a consensus over which is better.
I'd like to use this debate to gather reasons for using one over the other in the context of web development. I suspect there will be no clear winner, but it should serve as a useful resource for those faced with the decision!
NB. You can post code with the [code] bbcode tag. Many languages are supported. e.g.
[code python]
print "Hello, World!"
[/code]
When programming (X)HTML templates, it is important for security reasons to escape any user-generated input, as otherwise users may be able to sneak arbitrary HTML into a page that other uses see. XML-based templating languages such as ZPT or Genshi support automatic escaping by default. Text-based templating languages such as Django's and Mako apparently do not. The knowledge of the underlying XML structure may make automatic escaping more easier to implement. While the lack of this security feature may not be an inherent shortcoming of text-based templating languages, it does at least seem to be a cultural difference.
Martijn
Text-based templating languages such as Django's and Mako apparently do not .