Ticket #14785: middleware-doc-fixes.diff

File middleware-doc-fixes.diff, 7.2 KB (added by Adam Vandenberg, 14 years ago)
  • docs/ref/middleware.txt

    diff --git a/docs/ref/middleware.txt b/docs/ref/middleware.txt
    index eb746e4..b3ddb23 100644
    a b Cache middleware  
    1818.. module:: django.middleware.cache
    1919   :synopsis: Middleware for the site-wide cache.
    2020
    21 .. class:: django.middleware.cache.UpdateCacheMiddleware
     21.. class:: UpdateCacheMiddleware
    2222
    23 .. class:: django.middleware.cache.FetchFromCacheMiddleware
     23.. class:: FetchFromCacheMiddleware
    2424
    2525Enable the site-wide cache. If these are enabled, each Django-powered page will
    2626be cached for as long as the :setting:`CACHE_MIDDLEWARE_SECONDS` setting
    defines. See the :doc:`cache documentation </topics/cache>`.  
    3232.. module:: django.middleware.common
    3333   :synopsis: Middleware adding "common" conveniences for perfectionists.
    3434
    35 .. class:: django.middleware.common.CommonMiddleware
     35.. class:: CommonMiddleware
    3636
    3737Adds a few conveniences for perfectionists:
    3838
    View metadata middleware  
    8080.. module:: django.middleware.doc
    8181   :synopsis: Middleware to help your app self-document.
    8282
    83 .. class:: django.middleware.doc.XViewMiddleware
     83.. class:: XViewMiddleware
    8484
    8585Sends custom ``X-View`` HTTP headers to HEAD requests that come from IP
    8686addresses defined in the :setting:`INTERNAL_IPS` setting. This is used by
    GZIP middleware  
    9292.. module:: django.middleware.gzip
    9393   :synopsis: Middleware to serve gziped content for performance.
    9494
    95 .. class:: django.middleware.gzip.GZipMiddleware
     95.. class:: GZipMiddleware
    9696
    9797Compresses content for browsers that understand gzip compression (all modern
    9898browsers).
    Conditional GET middleware  
    109109.. module:: django.middleware.http
    110110   :synopsis: Middleware handling advanced HTTP features.
    111111
    112 .. class:: django.middleware.http.ConditionalGetMiddleware
     112.. class:: ConditionalGetMiddleware
    113113
    114114Handles conditional GET operations. If the response has a ``ETag`` or
    115115``Last-Modified`` header, and the request has ``If-None-Match`` or
    Also sets the ``Date`` and ``Content-Length`` response-headers.  
    121121Reverse proxy middleware
    122122------------------------
    123123
    124 .. class:: django.middleware.http.SetRemoteAddrFromForwardedFor
     124.. class:: SetRemoteAddrFromForwardedFor
    125125
    126126.. versionchanged:: 1.1
    127127
    Locale middleware  
    134134.. module:: django.middleware.locale
    135135   :synopsis: Middleware to enable language selection based on the request.
    136136
    137 .. class:: django.middleware.locale.LocaleMiddleware
     137.. class:: LocaleMiddleware
    138138
    139139Enables language selection based on data from the request. It customizes
    140140content for each user. See the :doc:`internationalization documentation
    Message middleware  
    146146.. module:: django.contrib.messages.middleware
    147147   :synopsis: Message middleware.
    148148
    149 .. class:: django.contrib.messages.middleware.MessageMiddleware
     149.. class:: MessageMiddleware
    150150
    151151.. versionadded:: 1.2
    152152   ``MessageMiddleware`` was added.
    Session middleware  
    160160.. module:: django.contrib.sessions.middleware
    161161   :synopsis: Session middleware.
    162162
    163 .. class:: django.contrib.sessions.middleware.SessionMiddleware
     163.. class:: SessionMiddleware
    164164
    165165Enables session support. See the :doc:`session documentation
    166166</topics/http/sessions>`.
    Authentication middleware  
    171171.. module:: django.contrib.auth.middleware
    172172  :synopsis: Authentication middleware.
    173173
    174 .. class:: django.contrib.auth.middleware.AuthenticationMiddleware
     174.. class:: AuthenticationMiddleware
    175175
    176176Adds the ``user`` attribute, representing the currently-logged-in user, to
    177177every incoming ``HttpRequest`` object. See :doc:`Authentication in Web requests
    CSRF protection middleware  
    184184   :synopsis: Middleware adding protection against Cross Site Request
    185185              Forgeries.
    186186
    187 .. class:: django.middleware.csrf.CsrfMiddleware
     187.. class:: CsrfMiddleware
    188188
    189189.. versionadded:: 1.0
    190190
    Transaction middleware  
    198198.. module:: django.middleware.transaction
    199199   :synopsis: Middleware binding a database transaction to each Web request.
    200200
    201 .. class:: django.middleware.transaction.TransactionMiddleware
     201.. class:: TransactionMiddleware
    202202
    203203Binds commit and rollback to the request/response phase. If a view function
    204204runs successfully, a commit is done. If it fails with an exception, a rollback
  • docs/topics/http/middleware.txt

    diff --git a/docs/topics/http/middleware.txt b/docs/topics/http/middleware.txt
    index 24d2a8e..d376c6b 100644
    a b dictionary of keyword arguments that will be passed to the view. Neither  
    8989(``request``).
    9090
    9191``process_view()`` is called just before Django calls the view. It should
    92 return either ``None`` or an :class:`~django.http. HttpResponse` object. If it
     92return either ``None`` or an :class:`~django.http.HttpResponse` object. If it
    9393returns ``None``, Django will continue processing this request, executing any
    9494other ``process_view()`` middleware and, then, the appropriate view. If it
    95 returns an :class:`~django.http. HttpResponse` object, Django won't bother
     95returns an :class:`~django.http.HttpResponse` object, Django won't bother
    9696calling ANY other request, view or exception middleware, or the appropriate
    97 view; it'll return that :class:`~django.http. HttpResponse`. Response
     97view; it'll return that :class:`~django.http.HttpResponse`. Response
    9898middleware is always called on every response.
    9999
    100100.. _response-middleware:
    middleware is always called on every response.  
    105105.. method:: process_response(self, request, response)
    106106
    107107``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is the
    108 :class:`~django.http. HttpResponse` object returned by a Django view.
     108:class:`~django.http.HttpResponse` object returned by a Django view.
    109109
    110 ``process_response()`` must return an :class:`~django.http. HttpResponse`
     110``process_response()`` must return an :class:`~django.http.HttpResponse`
    111111object. It could alter the given ``response``, or it could create and return a
    112 brand-new :class:`~django.http. HttpResponse`.
     112brand-new :class:`~django.http.HttpResponse`.
    113113
    114114Unlike the ``process_request()`` and ``process_view()`` methods, the
    115115``process_response()`` method is always called, even if the ``process_request()``
    116116and ``process_view()`` methods of the same middleware class were skipped because
    117 an earlier middleware method returned an :class:`~django.http. HttpResponse`
     117an earlier middleware method returned an :class:`~django.http.HttpResponse`
    118118(this means that your ``process_response()`` method cannot rely on setup done in
    119119``process_request()``, for example). In addition, during the response phase the
    120120classes are applied in reverse order, from the bottom up. This means classes
    defined at the end of :setting:`MIDDLEWARE_CLASSES` will be run first.  
    132132
    133133Django calls ``process_exception()`` when a view raises an exception.
    134134``process_exception()`` should return either ``None`` or an
    135 :class:`~django.http. HttpResponse` object. If it returns an
    136 :class:`~django.http. HttpResponse` object, the response will be returned to
     135:class:`~django.http.HttpResponse` object. If it returns an
     136:class:`~django.http.HttpResponse` object, the response will be returned to
    137137the browser. Otherwise, default exception handling kicks in.
    138138
    139139Again, middleware are run in reverse order during the response phase, which
Back to Top