If I remember correctly Mako requires that you add a search path
configuration and set that up when you create the engine.

This may just work if you setup the config properly, or we may have to
add something to the routine which prepares the engine -- fortunately
that's a very simple process.

If setting the config doesn't work please add a ticket to Track and
we'll make it happen.   And if for some reason  you're feeling
ambitious fell free to add a patch too.  :)

Also, while I think of it, it's definitely worth documenting this in
the TG2 portion of the docs wiki,

--Mark

On 7/10/07, Olli Wang <[EMAIL PROTECTED]> wrote:
>
> Hi, Mark.
>
> When I prefix my templates with mako, in my example,
> @expose('mako:tg2test.templates.index').
>
> I got error traceback said I don't have certain file on that path but
> I do.
>
> Error Traceback
> clear this
> clear this
> Module tg.controllers:147 in route
> Module tg.controllers:94 in _tg_render_response
> Module pylons.templating:224 in render
> <<          log.debug("Rendering template %s with engine %s.",
> full_path, engine_name)
>             return engine_config['engine'].render(namespace,
> template=full_path,
>                 **options)>>  **options)
> Module mako.ext.turbogears:43 in render
> <<      def render(self, info, format="html", fragment=False,
> template=None):
>             if isinstance(template, basestring):
>                 template = self.load_template(template)
>
>             # Load extra vars func if provided
>     >>  template = self.load_template(template)
> Module mako.ext.turbogears:39 in load_template
> <<
>             # Lookup template
>             return self.lookup.get_template(templatename)
>
>         def render(self, info, format="html", fragment=False,
> template=None):>>  return self.lookup.get_template(templatename)
> Module mako.lookup:72 in get_template
> <<                      return self.__load(srcfile, uri)
>                 else:
>                     raise exceptions.TopLevelLookupException("Cant
> locate template for uri '%s'" % uri)
>
>         def adjust_uri(self, uri, relativeto):>>  raise
> exceptions.TopLevelLookupException("Cant locate template for uri '%s'"
> % uri)
> <class 'mako.exceptions.TopLevelLookupException'>: Cant locate
> template for uri '/tg2test/templates/index.mak'
>
> On Jul 11, 1:47 am, "Mark Ramm" <[EMAIL PROTECTED]> wrote:
> > I think prefixing your templates with mako:   will work
> >
> > I think there's a bug in that genshi is hardcoded in as the default
> > templating engine.
> >
> > --Mark
> >
> > On 7/10/07, Olli Wang <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I tried it already, but it didn't work.
> >
> > > Also, if I add something like "mako:project/templates/index" in
> > > decorator expose that doesn't work too.
> >
> > > It said I don't have certain file on the path but I did. :(
> >
> > > On Jul 10, 10:13 pm, gasolin <[EMAIL PROTECTED]> wrote:
> > > > On 7月10日, 下午6時12分, Olli Wang <[EMAIL PROTECTED]> wrote:
> >
> > > > > Hi, I just switched to TG2 trunk. I hope to use Mako template engine
> > > > > in my app but don't know how to set up. It seems the setting is
> > > > > different from original pylons, right?
> >
> > > > Hi,
> >
> > > > A quick hack is to change config/environment.py
> >
> > > > from
> >
> > > > template_engine='genshi'
> >
> > > > to
> >
> > > > template_engine='mako'
> >
> > > > the setting is the same as pylons at this time, but it may changed to
> > > > some simpler form
> >
> > > > --
> > > > Fred
> >
> > --
> > Mark Ramm-Christensen
> > email: mark at compoundthinking dot com
> > blog:www.compoundthinking.com/blog
>
>
> >
>


-- 
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to