def process_template_response(self, _request, response):
        # Error responses do not have context.
        if response.status_code in [500, 503]:
            return response

        page_token = response.context_data.get(HELP_CONTEXT_TOKEN_NAME)
        response.context_data['help_url'] = get_doc_url(page_token)
        return response
    def process_template_response(self, _request, response):
        # Error responses do not have context.
        if response.status_code == 500:
            return response

        page_token = response.context_data.get(HELP_CONTEXT_TOKEN_NAME)
        response.context_data['help_url'] = get_doc_url(page_token)
        return response
    def process_template_response(self, _request, response):
        # Ignore the django rest framework Response, which unfortunately
        # activates the "template response" middleware because it has a
        # render() method.
        if isinstance(response, Response):
            return response
        # Error responses do not have context.
        if response.status_code in [500, 503]:
            return response

        page_token = response.context_data.get(HELP_CONTEXT_TOKEN_NAME)
        response.context_data['help_url'] = get_doc_url(page_token)
        return response
示例#4
0
    def process_template_response(self, _request, response):
        # Ignore the django rest framework Response, which unfortunately
        # activates the "template response" middleware because it has a
        # render() method.
        if isinstance(response, Response):
            return response
        # Error responses do not have context.
        if response.status_code in [500, 503]:
            return response

        page_token = response.context_data.get(HELP_CONTEXT_TOKEN_NAME)
        response.context_data['help_url'] = get_doc_url(page_token)
        return response
示例#5
0
 def assertValidDocURL(self, page_token, expected_url):
     actual = get_doc_url(page_token)
     self.assertEqual(actual, expected_url)
 def assertValidDocURL(self, page_token, expected_url):
     actual = get_doc_url(page_token)
     self.assertEqual(actual, expected_url)