      pass
  
  def csrf_exempt(view_func):
      """
      Marks a view function as being exempt from the CSRF checks
      """
      def wrapped_view(*args, **kwargs):
          return view_func(*args, **kwargs)
      # We could just do view.csrf_exempt = True, but decorators are
      # nicer if they don't have side-effects.
 
</s> remove     # We could just do view.csrf_exempt = True, but decorators are
    # nicer if they don't have side-effects.
 </s> add  </s> remove def csrf_exempt(view_func):
 </s> add def csrf_response_exempt(view_func): </s> remove             # This covers a corner case in which the outgoing request
 </s> add             # This covers a corner case in which the outgoing response </s> remove         resp_content = resp.content
 </s> add 	resp_content = resp.content # needed because process_response modifies resp
    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):
      pass
  
  def csrf_exempt(view_func):
      """
    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):
      """
      def wrapped_view(*args, **kwargs):
          return view_func(*args, **kwargs)
      # We could just do view.csrf_exempt = True, but decorators are
      # nicer if they don't have side-effects.
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/middleware.py