-
-
Notifications
You must be signed in to change notification settings - Fork 800
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
Fixed URLRouter root_path handling. #1954
Conversation
root_path = scope.get("root_path", "") | ||
if root_path and not path.startswith(root_path): | ||
# If root_path is present, path must start with it. | ||
raise ValueError("No route found for path %r." % path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably mention root_path
as well, but I was not sure how best to phrase it. Suggestions welcome.
any news on when this could be merged ? |
@tevariou It's on my list to review now. |
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>
If we have a scope["root_path"], raise if it does not prefix scope["path"], and strip it from scope["path"] if it does. Do this only if we're in an outermost URLRouter. Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>
bbf33a7
to
b7032d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I finally got to it. Thanks @asedeno, and thanks for your patience.
As discussed in django/daphne#125, this adds handing of
scope["root_path"]
tochannels.routing.URLRouter
.