﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4149	cache_page decorator documented incorrectly	Chris Beaven	Jacob	"While investigating #2564, I found that the problem was actually incorrect use of the `cache_page` decorator, but the documentation recommends this incorrect format.

The [http://www.djangoproject.com/documentation/cache/#the-per-view-cache current documentation] says
{{{
It’s easy to use:

from django.views.decorators.cache import cache_page

def slashdot_this(request):
    ...

slashdot_this = cache_page(slashdot_this, 60 * 15)

Or, using Python 2.4’s decorator syntax:

@cache_page(60 * 15)
def slashdot_this(request):
    ...
}}}

The Python 2.4 syntax can ''not'' be used in this case.

`@cache_page(60 * 15)` is actually equivalent `slashdot_this = cache_page(60 * 15)(slashdot_this)` which is obviously incorrect (the `cache_page` decorator expects the both the function and any arguments to be passed directly to it)

The decorator (which is actually from `django.utils.decorators.decorator_from_middleware`) is the problem here and perhaps it's format should change - but for now, let's just fix the documentation."		closed	Documentation	dev		invalid			Unreviewed	0	0	0	0	0	0
