Esempio n. 1
0
    def process_request(self, request):
        """Replicates a lot of code from BaseHandler#get_response."""
        callback, callback_args, callback_kwargs = resolve(request.path_info)

        if getattr(callback, 'bypass_middleware', False):
            # bypass_middleware decorator was used; zero out all
            # middleware and return the response.
            handler = BaseHandler()

            handler._request_middleware = []
            handler._view_middleware = []
            handler._template_response_middleware = []
            handler._response_middleware = []
            handler._exception_middleware = []

            response = handler._get_response(request)

            return response
Esempio n. 2
0
    def process_request(self, request):
        """Replicates a lot of code from BaseHandler#get_response."""
        # Setup URL resolver
        urlconf = settings.ROOT_URLCONF
        urlresolvers.set_urlconf(urlconf)
        resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
        callback, callback_args, \
            callback_kwargs = resolver.resolve(request.path_info)

        if getattr(callback, 'bypass_middleware', False):
            # bypass_middleware decorator was used; zero out all
            # middleware and return the response.
            handler = BaseHandler()

            handler._request_middleware = []
            handler._view_middleware = []
            handler._template_response_middleware = []
            handler._response_middleware = []
            handler._exception_middleware = []

            response = handler.get_response(request)

            return response