On Saturday, July 30, 2011 12:54:03 PM UTC-7, Wyatt Baldwin wrote:
>
> With Pyramid 1.0, I could inherit from a template in another package using 
> the standard Mako syntax:
>
> # Paste config file:
> mako.directories = package_A:templates pacakge_B:templates
>
> # templates/layout.mako in package_A
> <html>
>     ...
> </html>
>
> # templates/app.mako in package_B
> <inherit file="/layout.mako" />
> ...
>
> When I upgraded to Pyramid 1.1, I started getting a template lookup error. 
> I had to change file="/layout.mako" to 
> file="package_A:templates/layout.mako" to get it working again.
>
> Has anyone else run into this issue?
>

 I dug into this a bit, and I think I see what's happening. I'm not sure if 
this a bug in Pyramid or in my configuration.

First of all, in my `main` function, I have a line like this:

    config.override_asset('my_framework', 'my_app')

In other words, I've specified that *all* assets in the framework package 
should be overridden by assets in the app package.

My mako.directories setting initially looks like this: ['my_app:templates', 
'my_framework:templates']. The first time a template is rendered, these 
asset specs are converted to absolute filesystem paths.

The problem is that 'my_framework:templates' is converted to 
'/path/to/my_app/templates' due to the override above, and the directory 
list used for template lookup ends up containing duplicate paths pointing to 
my_app's templates directory.

Of course, the net effect of all this is that if a template isn't found in 
the app package, the Mako template lookup machinery never checks to see if 
the framework might contain the template.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/6u0EmRo4w4sJ.
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