summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-09-16 03:54:28 -0400
committerChris McDonough <chrism@plope.com>2012-09-16 03:54:28 -0400
commit401b371e7933f48e4fac2627fa54f85ff9f0a9f0 (patch)
treee6398a67619d29161d46f96df646cb736a73f4c7 /docs/api
parentfa4672fcb490dd0767fed10c557734b43cd845b8 (diff)
parent64452edb014423054d1bbc0bb3ed8a3e47b6f611 (diff)
downloadpyramid-401b371e7933f48e4fac2627fa54f85ff9f0a9f0.tar.gz
pyramid-401b371e7933f48e4fac2627fa54f85ff9f0a9f0.tar.bz2
pyramid-401b371e7933f48e4fac2627fa54f85ff9f0a9f0.zip
Merge branch 'feature.subrequest'
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/request.rst49
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/api/request.rst b/docs/api/request.rst
index 1112ea069..1718d0743 100644
--- a/docs/api/request.rst
+++ b/docs/api/request.rst
@@ -161,6 +161,55 @@
request, the value of this attribute will be ``None``. See
:ref:`matched_route`.
+ .. method:: invoke_subrequest(request, use_tweens=False)
+
+ .. warning::
+
+ This API was added in Pyramid 1.4a1.
+
+ Obtain a response object from the Pyramid application based on
+ information in the ``request`` object provided. The ``request`` object
+ must be an object that implements the Pyramid request interface (such
+ as a :class:`pyramid.request.Request` instance). If ``use_tweens`` is
+ ``True``, the request will be sent to the :term:`tween` in the tween
+ stack closest to the request ingress. If ``use_tweens`` is ``False``,
+ the request will be sent to the main router handler, and no tweens will
+ be invoked. This isn't *actually* a method of the Request object; it's
+ a callable added when the Pyramid router is invoked, or when a
+ subrequest is invoked. This function also:
+
+ - manages the threadlocal stack (so that
+ :func:`~pyramid.threadlocal.get_current_request` and
+ :func:`~pyramid.threadlocal.get_current_registry` work during a
+ request)
+
+ - Adds a ``registry`` attribute (the current Pyramid registry) and a
+ ``invoke_subrequest`` attribute (a callable) to the request object it's
+ handed.
+
+ - sets request extensions (such as those added via
+ :meth:`~pyramid.config.Configurator.add_request_method` or
+ :meth:`~pyramid.config.Configurator.set_request_property`) on the
+ request it's passed.
+
+ - causes a :class:`~pyramid.event.NewRequest` event to be sent at the
+ beginning of request processing.
+
+ - causes a :class:`~pyramid.event.ContextFound` event to be sent
+ when a context resource is found.
+
+ - causes a :class:`~pyramid.event.NewResponse` event to be sent when
+ the Pyramid application returns a response.
+
+ - Calls any :term:`response callback` functions defined within the
+ request's lifetime if a response is obtained from the Pyramid
+ application.
+
+ - Calls any :term:`finished callback` functions defined within the
+ request's lifetime.
+
+ See also :ref:`subrequest_chapter`.
+
.. automethod:: add_response_callback
.. automethod:: add_finished_callback