Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

goodwillcoding
Copy link
Member

No description provided.

goodwillcoding and others added 2 commits May 5, 2024 01:18
Interpolate request.script_name for openapi path_pattern to accomodate
@goodwillcoding
Copy link
Member Author

@zupo this is the fix I mentioned in #104 ... let me know if it looks ok to you and if you'd want it and I'll add tests

@zupo
Copy link
Collaborator

zupo commented May 8, 2024

Can you please add a functional test for this?

@goodwillcoding goodwillcoding changed the title Fix for #104, adding support for mounted apps [partial PR] Fix for #104, adding support for mounted apps May 9, 2024
@goodwillcoding
Copy link
Member Author

Hi @zupo. I cleaned up the fix and updated the existing test for test_relative_app_request which tests path_pattern and it looks like that's the only test that needed to be done.

The PR checks above fail on pyupgrade run and I have not been able to reproduce that locally either via pyupgrade or pre-commit run. Not sure what to do there.

@zupo
Copy link
Collaborator

zupo commented May 9, 2024

The PR checks above fail on pyupgrade run and I have not been able to reproduce that locally either via pyupgrade or pre-commit run. Not sure what to do there.

I'll have a look.

Copy link
Collaborator

@zupo zupo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor suggestions.

else self.request.path_info
)

# since application might be mounted on virtual location we need
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# since application might be mounted on virtual location we need
# Since application might be mounted on virtual location we need


# 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# will fail. one example of this is using WSGI compositors like
# will fail. One example of this is using WSGI compositors like

Comment on lines +46 to +49
path_pattern = "%s%s" % (
self.request.script_name,
self.request.matched_route.pattern,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path_pattern = "%s%s" % (
self.request.script_name,
self.request.matched_route.pattern,
)
path_pattern = f"{self.request.script_name}{self.request.matched_route.pattern}"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also fix the pyupgrade warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants