Hi list,

I'm getting an error with the 'render_to_response' function for mako
templates with pyramid >= 1.3.1.

The following code worked for versions <=1.3.0:

## In __init__.py:

config.add_route('pages', '/p/{pagename}.html')

## In views.py:

@view_config(route_name='pages')
def rendertemplates(request):
        pagename = request.matchdict['pagename']

        result = render_to_response('myproject:templates/
%s.mako'%pagename,
                              {},
                              request=request
                              )

       return result

# index.mako:
<%inherit file="base.mako" />

<p> hello index.html </p>

# base.mako:
<html>
<body>
${next.body()}
</body>
</html>


I'm using this very simple setup (well, templates are a little bit
more complicated) to serve quasi-static pages with the benefit of mako
templates.

This setup worked up to Pyramid 1.3.0.
Now I get a lookup error:
"""
TemplateLookupException: Cant locate template for uri u'myproject
$templates/base.mako'
"""

If I use an asset(?) for the inheritance section in index.mako then it
works again:

#index.mako:
<%inherit file="myproject:base.mako" />


Is this a new mako templates inheritance convention? Is there a way to
get rid of the "myproject:" asset in templates? This would help
upgrading the Pyramid version without changing all mako templates.

I tried to set "mako.directories = myproject:templates" in
development.ini but it didn't change anything.

By the way, is there a security issue using the content
request.matchdict['pagename'] for rendering templates without escaping
special chars?

Thanks!
Adrien

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to