OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, app, environ, request=None, session=None) |
def | g (self) |
def | g (self, value) |
def | copy (self) |
def | match_request (self) |
def | push (self) |
def | pop (self, exc=_sentinel) |
def | auto_pop (self, exc) |
def | __enter__ (self) |
def | __exit__ (self, exc_type, exc_value, tb) |
def | __repr__ (self) |
Data Fields | |
app | |
request | |
url_adapter | |
flashes | |
session | |
preserved | |
The request context contains all request relevant information. It is created at the beginning of the request and pushed to the `_request_ctx_stack` and removed at the end of it. It will create the URL adapter and request object for the WSGI environment provided. Do not attempt to use this class directly, instead use :meth:`~flask.Flask.test_request_context` and :meth:`~flask.Flask.request_context` to create this object. When the request context is popped, it will evaluate all the functions registered on the application for teardown execution (:meth:`~flask.Flask.teardown_request`). The request context is automatically popped at the end of the request for you. In debug mode the request context is kept around if exceptions happen so that interactive debuggers have a chance to introspect the data. With 0.4 this can also be forced for requests that did not fail and outside of ``DEBUG`` mode. By setting ``'flask._preserve_context'`` to ``True`` on the WSGI environment the context will not pop itself at the end of the request. This is used by the :meth:`~flask.Flask.test_client` for example to implement the deferred cleanup functionality. You might find this helpful for unittests where you need the information from the context local around for a little longer. Make sure to properly :meth:`~werkzeug.LocalStack.pop` the stack yourself in that situation, otherwise your unittests will leak memory.
def __init__ | ( | self, | |
app, | |||
environ, | |||
request = None , |
|||
session = None |
|||
) |
def __enter__ | ( | self | ) |
def __exit__ | ( | self, | |
exc_type, | |||
exc_value, | |||
tb | |||
) |
def __repr__ | ( | self | ) |
def auto_pop | ( | self, | |
exc | |||
) |
def copy | ( | self | ) |
Creates a copy of this request context with the same request object. This can be used to move a request context to a different greenlet. Because the actual request object is the same this cannot be used to move a request context to a different thread unless access to the request object is locked. .. versionadded:: 0.10 .. versionchanged:: 1.1 The current session object is used instead of reloading the original data. This prevents `flask.session` pointing to an out-of-date object.
def g | ( | self | ) |
def g | ( | self, | |
value | |||
) |
def match_request | ( | self | ) |
Can be overridden by a subclass to hook into the matching of the request.
def pop | ( | self, | |
exc = _sentinel |
|||
) |
Pops the request context and unbinds it by doing that. This will also trigger the execution of functions registered by the :meth:`~flask.Flask.teardown_request` decorator. .. versionchanged:: 0.9 Added the `exc` argument.
def push | ( | self | ) |
Binds the request context to the current context.
app |
flashes |
preserved |
request |
session |
url_adapter |