'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 = {'HTTP_COOKIE': self.cookies.output(header='', sep=';    '), 'PATH_INFO': '/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'testserver', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.version': (1, 0), 'wsgi.url_scheme': 'http', 'wsgi.errors': self.errors, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False}
    environ.update(self.defaults)
    environ.update(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
        for detail in ('template', 'context'):
            if data.get(detail):
                if (len(data[detail]) == 1):
                    setattr(response, detail, data[detail][0])
                else:
                    setattr(response, detail, data[detail])
            else:
                setattr(response, detail, None)
        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')
