summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-12-04 07:05:57 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-12-04 07:05:57 +0000
commit5a792ec4ccacf7c68a3273763fab433bf57760fe (patch)
tree8e5acff1c938eb29831ef8113ced3589566fc587
parent821b7f362c84bdb527618416e0b237ab2d10e638 (diff)
[1.2.X] Fixed #14737 -- Moved the docstring comment for the cache_page decorator so it gets picked up as a docstring. Thanks to adamv for the report and patch.
Backport of r14798 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/views/decorators/cache.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/django/views/decorators/cache.py b/django/views/decorators/cache.py
index bba7cd962f..577c1ddab8 100644
--- a/django/views/decorators/cache.py
+++ b/django/views/decorators/cache.py
@@ -1,16 +1,3 @@
-"""
-Decorator for views that tries getting the page from the cache and
-populates the cache if the page isn't in the cache yet.
-
-The cache is keyed by the URL and some data from the headers. Additionally
-there is the key prefix that is used to distinguish different cache areas
-in a multi-site setup. You could use the sites.get_current().domain, for
-example, as that is unique across a Django project.
-
-Additionally, all headers from the response's Vary header will be taken into
-account on caching -- just like the middleware does.
-"""
-
try:
from functools import wraps
except ImportError:
@@ -22,6 +9,19 @@ from django.middleware.cache import CacheMiddleware
def cache_page(*args, **kwargs):
+ """
+ Decorator for views that tries getting the page from the cache and
+ populates the cache if the page isn't in the cache yet.
+
+ The cache is keyed by the URL and some data from the headers.
+ Additionally there is the key prefix that is used to distinguish different
+ cache areas in a multi-site setup. You could use the
+ sites.get_current().domain, for example, as that is unique across a Django
+ project.
+
+ Additionally, all headers from the response's Vary header will be taken
+ into account on caching -- just like the middleware does.
+ """
# We need backwards compatibility with code which spells it this way:
# def my_view(): pass
# my_view = cache_page(my_view, 123)