3 ms·
> Sometimes applications need to store data during the lifetime of a request, so that it can be shared between the before or after request handlers and the rout
by leetrout 3y ago
> Sometimes applications need to store data during the lifetime of a request, so that it can be shared between the before or after request handlers and the route function. The request object provides the g attribute for that purpose.
Eh I dont get it. "g" for globals?
- nicolaslem 3y agoI believe it's the same concept as `g` from flask.
- driggs 3y ago`g` is short for "global", but it is global to that request only. This makes data available to hooks which can wrap request handlers before/after they execute It's inspired by Flask's same functionality, though it's a part of the greater Application Context and Request Context in Flask, which Microdot apparently doesn't have: https://flask.palletsprojects.com/en/2.3.x/appcontext/#storing-data https://flask.palletsprojects.com/en/2.3.x/appcontext/#stori...