KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I saw that g will move from the request context to the app context in Flask 0.10, which made me confused about the intended use of g . My understanding (for Flask 0.9) is that: g lives in the request context, i.e., created afresh when the requests starts, and available until it ends g is intended to be used as a "request blackboard", where I can put stuff relevant for the duration of the request (i.e., set a flag at the beginning of the request and handle it at the end, possibly from a before_request / after_request pair) in addition to holding request-level-state, g can and should be used for resource management, i.e., holding database connections, etc. Which of these sentences are no longer true in Flask 0.10? Can someone point me to a resource discussing the reasons for the change? What should I use as a "request blackboard" in Flask 0.10 - should I create my own app/extension specific thread-local proxy and push it to the context stack before_request ? What's the point of resource management at the application context, if my application lives for a long while (not like a request) and thus the resources are never freed?
Tags (comma-separated)
Save Edits
Cancel