You can override the __getattr__ method of
web.contrib.template.render_mako to achieve that.
See this: http://dpaste.com/85078/ .
I have used jinja because I already had a sandbox setup using it.
1. there is no such convention in mako, as far I know and I have used
mako since it's myghty days.
Also, if you see the frontpage of makotemplates.org, the example
uses ".html" . "
2. gives sensible defaults. In web.py, .html always means a template.
This is convention over configuration.
3. The IF-ELSE blocks just increases the amount of code in the base library.
+PG
On Fri, Oct 17, 2008 at 8:57 AM, Bibby <michae...@gmail.com> wrote:
>
> webpy use '.html' as default template file extension, hy not use
> '.mako' ('.tmpl' or whatever) for Mako template engine? it's easy to
> know what template engine it used.
>
> such as (web.contrib.template):
>
> ----<----
> class render_mako:
> ...skip...
> def __getattr__(self, name):
> # Assuming all templates are html
> #path = name + ".html"
> if os.path.exists(name + '.mako'):
> path = name + ".mako"
> elif os.path.exists(name + '.tmpl'):
> path = name + '.tmpl'
> else:
> path = name + '.html'
> t = self._lookup.get_template(path)
> return t.render
> ----<----
> >
>
--
Home - http://pradeepgowda.com
Heart - http://sampada.net
Yummy! - http://konkanirecipes.com