﻿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
25269	Method decorator should accept a iterable of decorators	zauddelig	nobody	"Hello,
The new method decorator allow to decorate a class directly. to augment its readability I would propose to let it accept an iterable of decorator functions.

This could be useful because it's common to decorate views using redundant sets of decorators inside the same project or subproject, one could argue that the same result is attained creating a new decorator or a Mixin, yet an iterable, i. e.  a tuple,  seem to me more plastic and maintainable than a class or a function.

This could be also useful if one intend to dynamically decorate dynamically created classes although this is most probably going to be useful in less than the 1% of the cases, so actually not significant.

The proposal introduces a polymorphic behaviour to `method_decorator` which should now accept both function and iterables, so both the following examples should be valid:

{{{
decorators = (
    blacklist_ip,
    request_is_cool,
    login_required,
)

@method_decorator(decorators,""dispatch"")
class ProtectedView(View):
    # lot of meaningful code
    pass

@method_decorator(login_required, ""dispatch"")
class LessProtectedView(View):
    # lot of meaningful code
    pass
}}}

pull request: https://github.com/django/django/pull/5134"	Uncategorized	new	Utilities	1.8	Normal				Unreviewed	1	1	0	0	0	0
