def setup(self, environ): '''Called once to setup the list of wsgi middleware.''' json_handler = Root().putSubHandler('calc', Calculator()) middleware = wsgi.Router('/', post=json_handler, accept_content_types=JSON_CONTENT_TYPES) response = [wsgi.GZipMiddleware(200)] return wsgi.WsgiHandler(middleware=[middleware], response_middleware=response)
def response_middleware(self, app): gzip = app.config['GZIP_MIN_LENGTH'] middleware = [] if gzip: middleware.append(wsgi.GZipMiddleware(gzip)) if app.config['USE_ETAGS']: middleware.append(self.etag) return middleware
def setup(self, environ): # only post allowed by the JSON RPC handler request = [wsgi.Router('/', post=RpcRoot(self.tqname))] response = [wsgi.GZipMiddleware(200)] return wsgi.WsgiHandler(middleware=request, response_middleware=response)