Auditing non-ASGI state. #1511
tomchristie
started this conversation in
General
Replies: 4 comments 12 replies
-
There's another one proposed by #1351 which solves a current bug. |
Beta Was this translation helpful? Give feedback.
1 reply
-
templates |
Beta Was this translation helpful? Give feedback.
5 replies
-
Could some of these be moved into an ASGI extension? |
Beta Was this translation helpful? Give feedback.
5 replies
-
In the "routing state" category, I also noticed router, just in one spot: starlette/starlette/routing.py Lines 651 to 652 in 6ad5a6a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's a bunch of places in Starlette that we store state in the ASGI scope, that's outside of the ASGI spec.
I'm... okay-ish about this, but we need to be careful about it.
We might want to consider namespacing these someday, not sure. But at a minimum we ought to make sure we've clearly identified where we're doing this at the moment. I think these are what we've got at the moment.
Middleware
session
auth
user
General purpose
app
- The application instance.state
- General purpose state on the request.Routing state
endpoint
- Could arguably be theroute
instead. Although unclear what we'd want to surmounted routes.path_params
app_root_path
- I introduced this in Include 'root_path' when returning URLs from request.url_for #699. And just... yuck. Needs to not exist really.router
- Urg. We shouldn't really need this, since we could instead access it viarequest.app.router
.Templating
extensions
/http.response.template
- Bit different - not part of the scope, but an ASGI messaging extension.Am I missing anything?
Beta Was this translation helpful? Give feedback.
All reactions