diff options
| author | Gabriel Hurley <gabehr@gmail.com> | 2010-11-06 09:21:00 +0000 |
|---|---|---|
| committer | Gabriel Hurley <gabehr@gmail.com> | 2010-11-06 09:21:00 +0000 |
| commit | 1423593e8fe21072de841183cd76a667b6523ed1 (patch) | |
| tree | b96f3d1c1be94067e1d06f6937a136bd0a8c46d0 /docs | |
| parent | c8c781a9d510def19720aca09b4a6d3cf75853f1 (diff) | |
[1.2.X] Fixed #14624 -- Updated a few outdated references to CacheMiddleware in the transactions topic guide. Thanks to quinode for the report.
Backport of [14470] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/transactions.txt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt index 2d99c17a32..be9d9a864f 100644 --- a/docs/topics/db/transactions.txt +++ b/docs/topics/db/transactions.txt @@ -32,13 +32,14 @@ If the view function produces an exception, Django rolls back any pending transactions. To activate this feature, just add the ``TransactionMiddleware`` middleware to -your ``MIDDLEWARE_CLASSES`` setting:: +your :setting:`MIDDLEWARE_CLASSES` setting:: MIDDLEWARE_CLASSES = ( + 'django.middleware.cache.UpdateCacheMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', - 'django.middleware.cache.CacheMiddleware', 'django.middleware.transaction.TransactionMiddleware', + 'django.middleware.cache.FetchFromCacheMiddleware', ) The order is quite important. The transaction middleware applies not only to @@ -46,9 +47,12 @@ view functions, but also for all middleware modules that come after it. So if you use the session middleware after the transaction middleware, session creation will be part of the transaction. -An exception is ``CacheMiddleware``, which is never affected. The cache -middleware uses its own database cursor (which is mapped to its own database -connection internally). +The various cache middlewares are an exception: +:class:`~django.middleware.cache.CacheMiddleware`, +:class:`~django.middleware.cache.UpdateCacheMiddleware`, and +:class:`~django.middleware.cache.FetchFromCacheMiddleware` are never affected. +Even when using database caching, Django's cache backend uses its own +database cursor (which is mapped to its own database connection internally). Controlling transaction management in views =========================================== |
