improved _request_ctx_stack docs

This commit is contained in:
Armin Ronacher 2010-06-29 15:25:20 +02:00
parent bcd746e8cf
commit 9373a71c26

View file

@ -301,6 +301,36 @@ Useful Internals
instance and can be used by extensions and application code but the
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
The request context is automatically popped at the end of the request