﻿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
13409	"""wrap"" argument for django.conf.urls.defaults.url to decorate views more easily"	Charlie DeTar	nobody	"The [http://docs.djangoproject.com/en/dev/topics/cache/#specifying-per-view-cache-in-the-urlconf documention for cacheing] recommends a method for using cache decorators in the urlconf, which is a natural way to do page-based cacheing.  However, most urlconfs of any complexity use string representations of views (and perhaps also the ""prefix"" feature of patterns()).  To decorate the views, one would have to import them all explicitly and then apply the wrapper functions, which is cumbersome.

The attached patch addresses this by adding a ""wrap"" function to url(), which specifies a function or list of functions with which to ""decorate"" the view.  For includes, the wrap argument applies to all included URLs.  It can be used like this:

{{{
urlpatterns = patterns('myapp.views',
    url(r'^pattern/$', 'viewfunc', wrap=mydecorator),
    url(r'^pattern2/$', include('otherapp.urls'), wrap=[mydecorator1, mydecorator2]),
)
}}}

This can provide a natural way to add cacheing or any other decoration (such as login_required) both to individual views, or to all the views within an include."	New feature	closed	Core (URLs)	dev	Normal	invalid	url, RegexURLResolver, RegexURLPattern, decorators	chazen@… erob@… Florian.Sening@…	Accepted	1	1	1	0	0	0
