-
Notifications
You must be signed in to change notification settings - Fork 887
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
Detect routes that collide during registration #3691
Comments
I think that at least this would be a good recipe for the Community Cookbook if nothing else. The Testing section is pretty thin. https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/testing/index.html Maybe a new page for Pyramid pytest recipes? See also https://docs.pylonsproject.org/projects/pyramid/en/latest/designdefense.html#routes-need-relative-ordering and https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/urldispatch.html#route-declaration-ordering |
I think it would be hard to craft a patch that we would merge for this. There are so many corner cases where warnings are not desirable when you bring in other features of route configuration that can be used to solve conflicts - namely route predicates. |
Alright no problem, I understand and for sure I don't want to add code that would be difficult to maintain. What I have is the following (to give a rough idea of how it looks, there are still things to improve in order to make it more generic). It is plug-and-play with the pyramid cookie cutter
Were you suggesting to add a bullet point below "Testing a POST request using cURL" in this page. If that's still what you want, I can open a PR and then we can go through formal code review there of course |
Yes, as well as a link to a new page that contains the recipe. |
I wonder if this would be an interesting use of an add-on, for the wide number of simple apps that are not using more sophisticated features. like |
I've recently been hit by this problem, after changing the ordering in which controllers were registered, some routes weren't called.
This is because some routes using pattern matching were registered before other routes.
For instance route
/users/{user_id}
registered before/users/export
Of course this can be fixed by changing the ordering in which routes get registered but it is something that is probably bugging other users and that can be detected.
I was able to have a unit test that would detect this in our project (by parsing
proutes
output) but I was wondering if that is a feature that could be of interest to be baked in pyramid itself? I'd be happy to hack on this, please just point me to a starting point in the codebaseThe text was updated successfully, but these errors were encountered: