>>> from jinja2 import TemplateSo what does this mean?
>>> t = Template('{{ name }} rocks!')
>>> t.render(name='Guido')
u'Guido rocks!'
It means that right now you can have Django style templates inside of Plone, Zope, Grok, et al. However, you can't mix TAL and Jinja2 in any way via template inheritence.
Off the top of my head I can think of two possible use cases:
- You have the HATE for XML based template languages and just need something else for all rendering of all content including HTML. This is actually a very feasible option for Grok and pure Zope application development, yet functionally impossible for Plone. Too much of Plone is woven into TAL to make this work.
- You are using lots of AJAX via KSS, JQuery, YUI, plain old JavaScript, etc and want something handy to help you write content coming from the server side. This is feasible in Zope, Grok, and even Plone.
Thanks to the the indomitable Ian Bicking for suggesting Jinja2.
3 comments:
Macros aren't the only way to integrate a template, you can always do
tal:replace="structure view/my_jinja_template"
@Laurence Row: Good point. Thanks very much!
``z3c.pt`` introduces "text templates" which will evaluate ${some_path_expression} –– e.g. ${python: 2 + 2}; you can't do TALES evaluation with any other template engine.
Post a Comment