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
NestedViewSetMixin returns ValueError if the wrong pk type is given in URL #86
Comments
A suggestion for a fix here is to have a try-except around
This would cause the server to respond with 404 Not Found instead. I noticed that Django did something similar here: |
If a route such as /users/NOT_AN_INTEGER/settings would be requested and the /users endpoint expects an integer as the second part of the url then this request would throw a internal server error. This is a temp fix and a proper solution should be found. Discussion about this can be found on Github: chibisov#86 chibisov#63 chibisov#50
If a route such as /users/NOT_AN_INTEGER/settings would be requested and the /users endpoint expects an integer as the second part of the url then this request would throw a internal server error. This is a temp fix and a proper solution should be found. Discussion about this can be found on Github: chibisov#86 chibisov#63 chibisov#50
Sorry, but I don't see that as a proper solution. That would put the responsibility on the developer using drf-extensions, to see to it that a 500 error is thrown on a default setup. That is not OK in my book at least. The problem here is not that the router does not handle custom regex values, but that it tries filtering a query with non-proper values. I have created a pull request with the fix I thought was temporary but seems to be the proper one after creating #87. |
If a route such as /users/NOT_AN_INTEGER/settings would be requested and the /users endpoint expects an integer as the second part of the url then this request would throw a internal server error. This is a temp fix and a proper solution should be found. Discussion about this can be found on Github: chibisov#86 chibisov#63 chibisov#50
PR? |
@frwickst this issue should be open to be fixed with workaround? |
Lets say you have the following nested url:
/books/23/pages, which works fine, and then change the url to
/books/NOT_AN_INTEGER/pages
this will cause the server to throw:
The route is of course wrong, but it should return 404 and not a 500 error
I am running:
Django 1.7
djangorestframework 3.1.1
drf-extensions 1.5.2
The text was updated successfully, but these errors were encountered: