-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mako template lookup fails in 1.3.3 #662
Comments
A simple Pyramid project that will demo this bug is located at https://github.com/landreville/mako-lookup-error |
Your project demo raises a 404 error :( |
I just corrected the link |
It looks like the recent fixes for mako lookups with asset specs in 1.3.3 have caused this bug. In pyramid/mako_templating.py line 49 (in PkgResourceTemplateLookup.adjust_uri()) it splits the renderer asset spec and makes the inherit URI relative to the same place as the path in the asset spec (which is the python package). The inherit URI is actually relative to the mako template directory so of course it cannot find the template.
|
You're right.. However I'm not sure it makes sense to mixup asset specs and mako templates absolute paths? If you are using both relative and absolute mako paths it works as it should, and then it works with asset spec and relative mako paths. Why do you need to mixup both? |
try this branch and see if it fixes your problem: https://github.com/Pylons/pyramid/tree/fix.mako-662 |
I should mention that in my project the inherited template is also in a different mako lookup directory so a relative path would not work. Using asset specifications for every template URI would limit my ability to easily change template locations. If I use the mako directories configuration I can move the directory and change a single setting instead of updating every reference to a template. However, sometimes it is more straightforward to use an asset specification, especially if the template isn't in a mako lookup directory. I don't see why I should be limited to only using asset specifications or paths instead of both. |
I think that branch fixes it -- I will try it out a bit more |
You reached the case that was not covered, an asset spec template inheriting from an absolute uri. Of course you should not be limited ;) |
That fix works, thanks! |
awesome... will be included in the next version update |
A fix will be in 1.4. If someone is industrious enough to port the fixes to the 1.3 branch, we could release a 1.3 version with it in it too. |
Already back ported to 1.3 branch, ready for next release: https://github.com/Pylons/pyramid/blob/1.3-branch/CHANGES.txt#L13 |
Cool. It'll go out with the next 1.3 release then. |
Starting in 1.3.3 mako template lookup fails when the renderer argument to view_config is an asset specification to a mako template and within that mako template an inherit tag contains an absolute URI (eg '/somedir/mytemplate.mako'). This bug was not present in pyramid 1.3.2.
The follow traceback will be displayed when rendering the page:
The text was updated successfully, but these errors were encountered: