  happen to the response, so it must come after GZipMiddleware in the
  list.
  
  Exceptions
  ----------
  
  .. versionadded:: 1.1
  
 
</s> remove The above two functions of ``CsrfMiddleware`` are split between two
classes: ``CsrfResponseMiddleware`` and ``CsrfViewMiddleware``
respectively.  This allows the individual components to be used and/or
replaced instead of using ``CsrfMiddleware``.

.. versionchanged:: 1.1
    (previous versions of Django did not provide these two components
    of ``CsrfMiddleware`` as described above)
 </s> add  </s> remove You don't have to worry about doing this for most AJAX views. Any request sent
with "X-Requested-With: XMLHttpRequest" is automatically exempt. (See the next
section.)
 </s> add Like the middleware itself, the ``csrf_exempt`` decorator is composed
of two parts: a ``csrf_view_exempt`` decorator and a
``csrf_response_exempt`` decorator, found in the same module.  These
disable the view protection mechanism (``CsrfViewMiddleware``) and the
response post-processing (``CsrfResponseMiddleware``) respectively.
They can be used individually if required.

You don't have to worry about doing this for most AJAX views. Any
request sent with "X-Requested-With: XMLHttpRequest" is automatically
exempt. (See the next section.) </s> remove    isn't, the user will get a 403 error.
 </s> add    isn't, the user will get a 403 error. (This is done by
   ``CsrfViewMiddleware``) </s> remove             # This covers a corner case in which the outgoing request
 </s> add             # This covers a corner case in which the outgoing response
The ``CsrfMiddleware`` class is actually composed of two middleware:
``CsrfViewMiddleware`` which performs the checks on incoming requests,
and ``CsrfResponseMiddleware`` which performs post-processing of the
result.  This allows the individual components to be used and/or
replaced instead of using ``CsrfMiddleware``.

.. versionchanged:: 1.1
    (previous versions of Django did not provide these two components
    of ``CsrfMiddleware`` as described above)

  happen to the response, so it must come after GZipMiddleware in the
  list.
  
The ``CsrfMiddleware`` class is actually composed of two middleware:
``CsrfViewMiddleware`` which performs the checks on incoming requests,
and ``CsrfResponseMiddleware`` which performs post-processing of the
result.  This allows the individual components to be used and/or
replaced instead of using ``CsrfMiddleware``.

.. versionchanged:: 1.1
    (previous versions of Django did not provide these two components
    of ``CsrfMiddleware`` as described above)

  Exceptions
  ----------
  
  .. versionadded:: 1.1
  
keep keep add 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 
docs/ref/contrib/csrf.txt