예제 #1
0
파일: apptest.py 프로젝트: brettgoss/zoom
    def handle(self, request):
        handlers = (
            middleware.zoom.request.handler,
            middleware.zoom.profiler.handler,
            middleware.reset_modules,
            middleware.capture_stdout,
            middleware.zoom.site.handler,
            middleware.serve_themes,
            middleware.zoom.database.handler,
            middleware.zoom.queues.handler,
            middleware.zoom.models.handler,
            middleware.zoom.logging.handler,
            middleware.zoom.session.handler,
            middleware.zoom.component.handler,
            # # middleware.check_csrf,
            middleware.zoom.users.handler,
            middleware.zoom.render.handler,
            middleware.display_errors,
            middleware.zoom.apps.handler,
            middleware.not_found,
        )
        response = middleware.handle(request, handlers)

        self.session_token = request.session_token
        self.subject_token = request.subject_token

        self.logger.info('%s - %.0fms', request.path, request.elapsed * 1000)
        self.logger.debug('\n\n')
        return response
예제 #2
0
def debug(environ, start_response):
    """Configuration Debugging App"""
    request = Request(environ)
    response = middleware.handle(request, middleware.DEBUGGING_HANDLERS)
    status, headers, body = response.as_wsgi()
    start_response(status, headers)
    return [body]
예제 #3
0
 def __call__(self, environ, start_response):
     reset_modules()
     start_time = timer()
     request = Request(environ, self.instance, start_time)
     response = middleware.handle(request, self.handlers)
     status, headers, content = response.as_wsgi()
     start_response(status, headers)
     return [content]
예제 #4
0
def run_as_cgi(environ=None, instance=None):
    """Run Zoom as a CGI script"""
    env = environ or os.environ
    path = instance or os.path.realpath('..')
    start_time = timer()
    request = Request(env, path, start_time)
    response = middleware.handle(request)
    result = response.render()
    sys.stdout.buffer.write(result)