Advanced Flask Patterns, as linked by Markus, explains some of the changes to g in 0.10:
gnow lives in the application context.- Every request pushes a new application context, wiping the old one, so
gcan still be used to set flags per-request without change to code. - The application context is popped after
teardown_requestis called. (Armin’s presentation explains this is because things like creating DB connections are tasks which setup the environment for the request, and should not be handled insidebefore_requestandafter_request)