-
Notifications
You must be signed in to change notification settings - Fork 26
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
pyramid_layout breaks view lookup #33
Comments
This sounds like a route matching issue in your code. There is a usage pattern to register routes, as shown in the demo app that might help. |
As said here above, the issue is easily reproducible starting with the demo app. It has nothing to do with route registration, but with the fact that the layout predicate should not influence the way a view is matched or not (in fact it shoud not be a predicate). |
Here a test repo including the changes listed here above (more information in the README). |
This is due to the way that view matching works in Pyramid, and due to the fact that Pyramid matches views based upon some non-predicate information (IIRC permissions/accept are the only two) after that it matches based on longest predicate match:
Predicates:
Predicates:
Predicates:
Then here comes your home2:
Predicates:
Predicates:
Pyramid when given: http://0.0.0.0:6543/jinja2?view=html Will match in the order that views were registered, so since there are no permissions or accept that are not predicates, we basically ask for all views and start narrowing things down.
The next view that might match would be:
However, since both have a predicate length of 2 (longest match wins), it picks the first view found. You can see that with
If instead if we add the
Then it has the following predicates:
And thus it wins since it has the longest predicate chain:
The reason the tl;dr: |
any progress on this topic? |
@s4msung nope. Help is wanted. We'd accept a PR with tests, documentation updates, and a signed CONTRIBUTORS.txt. |
When using pyramid_layout with a non default layout, the request_param view predicates is not matched anymore.
Starting with the demo app, add following lines in views.py
Add a home2.mako and a home2.jinja2 in the demo/templates directory
Restart the demo server
If you go to
http://0.0.0.0:6543/?view=html
you get the expected 'It works' text.
If you go to
http://0.0.0.0:6543/home.jinja2?view=html
You fill on the home page and not on the expected one.
The text was updated successfully, but these errors were encountered: