-
Notifications
You must be signed in to change notification settings - Fork 889
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
add InstancePropertyHelper and apply_request_extensions #1581
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
from pyramid.exceptions import PredicateMismatch | ||
from pyramid.httpexceptions import HTTPNotFound | ||
from pyramid.request import Request | ||
from pyramid.request import apply_request_extensions | ||
from pyramid.threadlocal import manager | ||
|
||
from pyramid.traversal import ( | ||
|
@@ -213,7 +214,7 @@ def invoke_subrequest(self, request, use_tweens=False): | |
try: | ||
extensions = self.request_extensions | ||
if extensions is not None: | ||
request._set_extensions(extensions) | ||
apply_request_extensions(request, extensions=extensions) | ||
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.
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 is just an optimization to have the extensions queried from the registry only once at app-setup-time. This code is in pyramid's hot route, so I wanted to keep it as close to the original version as possible. |
||
response = handle_request(request) | ||
|
||
if request.response_callbacks: | ||
|
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.
Should we document how you would use
extensions
?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.
I explicitly left
extensions
off of the public api documentation. It's there just for pyramid's hot route in the router. TheIRequestExtensions
interface is private and shouldn't be used/passed-in directly by anyone. We do this in a few other places in the code for testing hooks.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.
We could name it
_extensions
if it would make you feel better.