Use flask.g instead of flask.request to hold private per-request state.
Rename flask.g._explain to flask.g._should_explain
Move initialization of flask.g._should_explain and flask.g._sql_profile
to a before_request handler.