Templating Systems

15 views
Skip to first unread message

pkraus

unread,
Apr 13, 2012, 9:46:02 AM4/13/12
to turbo...@googlegroups.com
By default TurboGears sets up the Genshi engine, but we also provide out of the box support for Mako and Jinja.

Can someone explain to me why one might choose one templating system over another? In what scenarios would you go with something besides the default genshi and why?

If its just a matter of comfort level and what you are used to then no big deal but if they have specific use cases it would be very good to know.

Carlos Daniel Ruvalcaba Valenzuela

unread,
Apr 13, 2012, 10:20:29 AM4/13/12
to turbo...@googlegroups.com
> Can someone explain to me why one might choose one templating system over
> another? In what scenarios would you go with something besides the default
> genshi and why?

Genshi is the default templating system, is a successor (so to speak)
of the Kid templating system (from TG 1), its main strength is that it
is XML based, it just extends XHTML instead of adding new syntax, this
means you can have your designer work with in on DreamWeaver or
whatever XHTML editor with little problems.

But Genshi has downsides too as XML processing does not come free, it
is a bit slow compared to text based templates, mako is there as to
offer a performance oriented option, it is fast.

Finally there is Jinja, which is fast and is very similar to django
templates, making it a good choice for those accustomed to django
templates, also many of the jinja features are very useful and Jinja
can be easily extended, there are even a tag extensions for jinja such
as embedding lesscss or coffeescript.

The problem here is compatibility, while you have choice the problem
lies on extensions, which may use a specific template system, for
example tgext.admin may use Genshi and expect you to have a genshi
master template, if you use jinja you can either have two master
templates (one for jinja and other for tgext.admin genshi) and
maintain them in sync or you can just break tgext.admin by not having
genshi.

Regards,
Carlos Daniel Ruvalcaba Valenzuela

Reply all
Reply to author
Forward
0 new messages