Browse Source

improved _request_ctx_stack docs

pull/112/head
Armin Ronacher 15 years ago
parent
commit
9373a71c26
  1. 30
      docs/api.rst

30
docs/api.rst

@ -301,6 +301,36 @@ Useful Internals
instance and can be used by extensions and application code but the instance and can be used by extensions and application code but the
use is discouraged in general. use is discouraged in general.
The following attributes are always present on each layer of the
stack::
`app`
the active Flask application.
`url_adapter`
the URL adapter that was used to match the request.
`request`
the current request object.
`session`
the active session object.
`g`
an object with all the attributes of the :data:`flask.g` object.
`flashes`
an internal cache for the flashed messages.
Example usage::
from flask import _request_ctx_stack
def get_session():
ctx = _request_ctx_stack.top
if ctx is not None:
return ctx.session
.. versionchanged:: 0.4 .. versionchanged:: 0.4
The request context is automatically popped at the end of the request The request context is automatically popped at the end of the request

Loading…
Cancel
Save