'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.
See the API for pyramid.request for complete documentation.'

def invoke_subrequest(self, request, use_tweens=False):

    request.registry = self.registry
    request.invoke_subrequest = self.invoke_subrequest
    extensions = self.request_extensions
    if (extensions is not None):
        apply_request_extensions(request, extensions=extensions)
    with RequestContext(request):
        return self.invoke_request(request, _use_tweens=use_tweens)
