'The master request method. Composes the environment dictionary
and passes to the handler, returning the result of the handler.
Assumes defaults for the query environment, which can be overridden
using the arguments to the request.'

def request(self, **request):

    environ = self._base_environ(**request)
    data = {}
    on_template_render = curry(store_rendered_templates, data)
    signals.template_rendered.connect(on_template_render, dispatch_uid='template-render')
    got_request_exception.connect(self.store_exc_info, dispatch_uid='request-exception')
    try:
        try:
            response = self.handler(environ)
        except TemplateDoesNotExist as e:
            if (e.args != ('500.html',)):
                raise
        if self.exc_info:
            exc_info = self.exc_info
            self.exc_info = None
            raise exc_info[1], None, exc_info[2]
        response.client = self
        response.request = request
        response.templates = data.get('templates', [])
        response.context = data.get('context')
        if (response.context and (len(response.context) == 1)):
            response.context = response.context[0]
        def _get_template(self):
            warnings.warn('response.template    is    deprecated;    use    response.templates    instead    (which    is    always    a    list)', PendingDeprecationWarning, stacklevel=2)
            if (not self.templates):
                return None
            elif (len(self.templates) == 1):
                return self.templates[0]
            return self.templates
        response.__class__.template = property(_get_template)
        if response.cookies:
            self.cookies.update(response.cookies)
        return response
    finally:
        signals.template_rendered.disconnect(dispatch_uid='template-render')
        got_request_exception.disconnect(dispatch_uid='request-exception')
