﻿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
1015	django.utils.decorators.decorator_from_middleware doesn't work with parameters	eugene@…	Adrian Holovaty	"{{{django.utils.decorators.decorator_from_middleware}}} doesn't work for decorators with parameters:

 1. Any parameter of decorator causes a call to {{{_decorator_from_middleware()}}}.
 1. Instead of actual wrapping {{{_wrapped_view()}}} is called, which fails because at that point {{{request}}} is actually a view function.

Basically this works:

{{{
#!python
@cache_page
def my_cool_view(request):
    # cool processing
}}}

This doesn't:

{{{
#!python
@cache_page(60)
def my_cool_view(request):
    # cool processing
}}}

Nor this:

{{{
#!python
@cache_page(cache_timeout=60)
def my_cool_view(request):
    # cool processing
}}}

Just try it.

If this is an intended behavior, we need to update documentation for {{{@cache_page}}}. (I didn't check if there is a documentation for {{{@gzip_page}}} and {{{@conditional_page}}}).

It makes sense to document that per-page caching still uses {{{CACHE_MIDDLEWARE_SECONDS}}} and {{{CACHE_MIDDLEWARE_KEY_PREFIX}}}, if no decorator arguments were given. And currently it is impossible to specify them."	defect	closed	Tools		normal	fixed	cache_page		Accepted	1	0	1	0	0	0
