Templating: .mak vs .mako vs Genshi

35 views
Skip to first unread message

Seth

unread,
May 13, 2009, 3:00:14 AM5/13/09
to TurboGears Trunk
I've been lurking in the #turbogears channel from time-to-time and
have observed some discussion of whether future TG releases should
have genshi or mako set as the default templating engine.

Having never tried Mako in a TG setting, I decided to fire up a new TG
2 test app to mess around with TG+Mako. I had the hardest time,
however, figuring out why TG wouldn't load my *.mako templates; until
I saw a post somewhere stating that TG uses ".mak" as its Mako
extension, not .mako.

Weird. Why is this? Is there a simple config variable somewhere to
make it load *.mako instead? (yes I'm lazy and would rather keep the
same file extension for my pylons and tg mako templates)

Also on a side note: I've noticed that the default TG 2 setup.py's
"message_extractors" line looks like it's matching '*.mako'. Is this a
bug?

Thanks,
Seth

cd34

unread,
May 13, 2009, 2:01:34 PM5/13/09
to TurboGears Trunk
I don't know why it defaults to .mak. It is hardcoded that way in
render.py and I ended up having to change the i18n config in setup.py
when I was working with translations. Seemed more prudent to change
the setup.py than to change the internals of TurboGears.

If I had to guess, Jinja is the favored template of the day until the
next new template engine comes along.

Mako had some issues with i18n when I tried it so I reverted back to
Genshi. Offhand, I don't recall the issues I ran into, but, when
making the message catalogs, not everything was properly translated
while a Genshi template had no issues. Portions of the Mako template
were translated, portions weren't though I don't recall the
specifics. Since the documentation was a bit sparse, I assumed it was
something I was doing wrong.

Jorge Vargas

unread,
May 15, 2009, 12:27:18 AM5/15/09
to turbogea...@googlegroups.com
On Wed, May 13, 2009 at 3:00 AM, Seth <seediff...@gmail.com> wrote:
>
> I've been lurking in the #turbogears channel from time-to-time and
> have observed some discussion of whether future TG releases should
> have genshi or mako set as the default templating engine.
>
> Having never tried Mako in a TG setting, I decided to fire up a new TG
> 2 test app to mess around with TG+Mako. I had the hardest time,
> however, figuring out why TG wouldn't load my *.mako templates; until
> I saw a post somewhere stating that TG uses ".mak" as its Mako
> extension, not .mako.
>
This is a bug/anti-feature of TW and the very old Buffet stuff. To be
honest I don't remember why anymore.

IMO they should be switch to .mako they just need someone to do the
work. But it needs to be fixed in TW and TG.

> Weird. Why is this? Is there a simple config variable somewhere to
> make it load *.mako instead? (yes I'm lazy and would rather keep the
> same file extension for my pylons and tg mako templates)
>
no, there is no config. .mak shouldn't be anyway.

> Also on a side note: I've noticed that the default TG 2 setup.py's
> "message_extractors" line looks like it's matching '*.mako'. Is this a
> bug?
>
Most likely. But the bug is .mak

> Thanks,
> Seth
> >
>

percious

unread,
May 18, 2009, 10:46:09 AM5/18/09
to TurboGears Trunk
.mak is also what TW uses, so there might be some historical
justification for using .mak

I personally +1 the effort to move over to .mako, and could/would make
the change in TW to match.

cheers.
-chris

On May 14, 10:27 pm, Jorge Vargas <jorge.var...@gmail.com> wrote:

Jorge Vargas

unread,
May 20, 2009, 12:29:18 AM5/20/09
to turbogea...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages