          CsrfViewMiddleware().process_view(req, token_view, (), {})
          resp = token_view(req)
          self._check_token_present(resp)
  
      def test_token_node_with_new_csrf_cookie(self):
          """
          Check that CsrfTokenNode works when a CSRF cookie is created by
          the middleware (when one was not already present)
          """
          req = self._get_GET_no_csrf_cookie_request()
 
</s> remove         if getattr(callback, 'csrf_exempt', False):
            return None

 </s> add  </s> remove from django.views.decorators.csrf import csrf_exempt
 </s> add from django.views.decorators.csrf import csrf_exempt, csrf_view_exempt
    def test_get_token_for_exempt_view(self):
        """
        Check that get_token still works for a view decorated with 'csrf_view_exempt'.
        """
        req = self._get_GET_csrf_cookie_request()
        CsrfViewMiddleware().process_view(req, csrf_view_exempt(token_view), (), {})
        resp = token_view(req)
        self._check_token_present(resp)

          CsrfViewMiddleware().process_view(req, token_view, (), {})
          resp = token_view(req)
          self._check_token_present(resp)
  
    def test_get_token_for_exempt_view(self):
        """
        Check that get_token still works for a view decorated with 'csrf_view_exempt'.
        """
        req = self._get_GET_csrf_cookie_request()
        CsrfViewMiddleware().process_view(req, csrf_view_exempt(token_view), (), {})
        resp = token_view(req)
        self._check_token_present(resp)

      def test_token_node_with_new_csrf_cookie(self):
          """
          Check that CsrfTokenNode works when a CSRF cookie is created by
          the middleware (when one was not already present)
          """
          req = self._get_GET_no_csrf_cookie_request()
keep keep keep add keep keep keep keep keep keep
 Fixed #13716 - the CSRF get_token function stopped working for views with csrf_view_exempt

This was a regression caused by the the CSRF changes in 1.2.

Thanks to edevil for the report.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@13336 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
tests/regressiontests/csrf_tests/tests.py