Exemplo n.º 1
0
Arquivo: web.py Projeto: kzinglzy/zest
    def response(self, environ, start_response):
        """ Respone from WSGI environ.
        """
        request = Request(environ)

        try:
            self.handle_before_request(request)

            rsp = self.match(request)()
            if is_async(rsp):
                rsp = yield from rsp
            response = self.make_response(rsp)
        except HTTPError as err:
            response = self.make_error_response(err, request)
        except Exception as exc:
            self.log_exception(exc)
            response = self.make_error_response(HTTPError(500))

        response = self.handle_after_request(response)
        return response.send(environ, start_response)