          Check that the token is inserted if there is an existing session
          """
          req = self._get_GET_session_request()
          resp = self._get_post_form_response()
          resp_content = resp.content
          resp2 = CsrfMiddleware().process_response(req, resp)
          self.assertNotEqual(resp_content, resp2.content)
          self._check_token_present(resp2)
  
      def test_process_response_new_session(self):
 
</s> remove         resp_content = resp.content
 </s> add 	resp_content = resp.content # needed because process_response modifies resp </s> remove         resp_content = resp.content
 </s> add 	resp_content = resp.content # needed because process_response modifies resp </s> remove         Check the AJAX requests are automatically exempted.
 </s> add         Check that AJAX requests are automatically exempted. </s> remove     Marks a view function as being exempt from the CSRF checks
 </s> add     Modifies a view function so that its response is exempt
    from the post-processing of the CSRF middleware.
    """
    def wrapped_view(*args, **kwargs):
        resp = view_func(*args, **kwargs)
	resp.csrf_exempt = True
	return resp
    return wraps(view_func)(wrapped_view)

def csrf_view_exempt(view_func):
	resp_content = resp.content # needed because process_response modifies resp
          Check that the token is inserted if there is an existing session
          """
          req = self._get_GET_session_request()
          resp = self._get_post_form_response()
	resp_content = resp.content # needed because process_response modifies resp
          resp2 = CsrfMiddleware().process_response(req, resp)
          self.assertNotEqual(resp_content, resp2.content)
          self._check_token_present(resp2)
  
      def test_process_response_new_session(self):
keep keep keep keep replace keep keep keep keep keep
 Made CSRF middleware skip post-processing for 'csrf_exempt' decorated views.

This commit also decomposes the decorator into two decorators which can be
used separately, adds some tests, updates docs and fixes some code comments.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@9815 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/contrib/csrf/tests.py