-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix for #104, adding support for mounted apps #244
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -36,11 +36,20 @@ def path(self) -> str: | |||||||||||
@property | ||||||||||||
def path_pattern(self) -> str: | ||||||||||||
"""The matched url with path pattern.""" # noqa D401 | ||||||||||||
path_pattern = ( | ||||||||||||
self.request.matched_route.pattern | ||||||||||||
if self.request.matched_route | ||||||||||||
else self.request.path_info | ||||||||||||
) | ||||||||||||
|
||||||||||||
# since application might be mounted on virtual location we need | ||||||||||||
# to prepend it to the route pattern, or request's response validation | ||||||||||||
# will fail. one example of this is using WSGI compositors like | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
# rutter (https://rutter.rtfd.io) | ||||||||||||
# see: https://wsgi.readthedocs.io/en/latest/definitions.html#envvar-SCRIPT_NAME | ||||||||||||
if self.request.matched_route: | ||||||||||||
path_pattern = "%s%s" % ( | ||||||||||||
self.request.script_name, | ||||||||||||
self.request.matched_route.pattern, | ||||||||||||
) | ||||||||||||
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also fix the pyupgrade warning. |
||||||||||||
else: | ||||||||||||
path_pattern = self.request.path | ||||||||||||
|
||||||||||||
return path_pattern | ||||||||||||
|
||||||||||||
@property | ||||||||||||
|
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.