Login to your account |
Other Options |

There are a number of very powerful template languages available in Python. Some template languages, such as Genshi [genshi.edgewall.org], allow complex Python statements and even full Python code within the template file. Others, such as Django [djangoproject.com] templates, prefer to restrict templates to presentation only and do not allow general Python expressions within the body of the template.
In the context of a web framework, is it better to have the full expressiveness of Python, or restrict templates to presentation only?
NB. You can post code with the [code] bbcode tag. Many languages are supported. e.g.
[code python]
print "Hello, World!"
[/code]
Mixing layout and logic makes for messy and complex code, that is hard to debug and maintain. So you need to separate logic and presentation. You can do this by convention if you are by yourself, but in a project where you are many, convention is not enough. Some lazy guy will sooner or later start putting in python code with logic in those clean pretty templates.
So you need a template language that simply does not let them do that.