def __call__(self, environ, start_response):
        """for wsgi server"""
        self.start_response = start_response
        path = environ['PATH_INFO']
        method = environ['REQUEST_METHOD']
        func, methods, func_kwargs = self.url_resolve(path)

        try:
            if func is None:
                self.notfound()
            if method not in methods:
                self.abort(405)
            request = Request(environ)
            result = self.handle_before_request_hooks(request, view_func=func)
            if isinstance(result, Response):
                response = result
            else:
                response = self.handle_view(request, func, func_kwargs)
            self.handle_after_request_hooks(request, response, view_func=func)
        except HTTPException as ex:
            response = ex.response

        return self._start_response(response)
def __call__ ( self , environ , start_response ) : self . start_response = start_response path = environ [ 'PATH_INFO' ] method = environ [ 'REQUEST_METHOD' ] func , methods , func_kwargs = self . url_resolve ( path ) try : if func is None : self . notfound ( ) if method not in methods : self . abort ( 405 ) request = Request ( environ ) result = self . handle_before_request_hooks ( request , view_func = func ) if isinstance ( result , Response ) : response = result else : response = self . handle_view ( request , func , func_kwargs ) self . handle_after_request_hooks ( request , response , view_func = func ) except HTTPException as ex : response = ex . response return self . _start_response ( response )
for wsgi server