Use an asset spec:

yourpackage:path/to/template.mako

On Thursday, August 22, 2013 10:51:32 AM UTC-4, András JÁKÓ wrote:
>
>  Hi,
>
> I'd like to use Mako templates in Pyramid 1.4.3 both with relative and 
> absolute pathnames, 
> but absolute ones don't seem to work.
>
> http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/templates.html#using-templates-directly
>  
> discussing render_to_response states: "Although a renderer path is usually 
> just 
> a simple relative pathname, a path named as a renderer can be absolute, 
> starting 
> with a slash on UNIX..." However when I call render_to_response with e.g. 
> renderer_name='/usr/local/www/t.mako', I get:
>
> TopLevelLookupException: Cant locate template for uri '/usr/local/www/t.mako'
>
> (/usr/local/www/t.mako does exist and is readable by the user running pserve.)
>
> Note that I also have mako.directories set, and relative pathnames (as well 
> as asset 
> specifications) work correctly.
>
> Looking at the traceback and the sources I see that in mako_templating.py 
> PkgResourceTemplateLookup.get_template() calls Mako's 
> TemplateLookup.get_template()
> with the absolute pathname I passed to render_to_response, but 
> TemplateLookup.get_template() 
> does not work with absolute pathnames. Mako's Tempate(filename) does work 
> with 
> absolute pathnames, but that's not what Pyramid calls here.
>
> What else should I check in my code? Or is it a bug in Pyramid or Mako?
>
> Regards,
> Andras
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to