If this has already been discussed/rejected/accepted, sorry, I did a search 
and found nothing.

There are several snippets and a number of methods to enable "universal" 
decorations of views in Django, but none of them feels really natural. 
Also, being able to keep this class of code in one place makes it easier to 
find.

Basically, what I propose is adding a middleware method, e.g. 
"decorate_view(...)", which returns the view function, decorated or not, or 
completely replaced. This new function would then be used as the "callback" 
before "process_view" is called in django/core/handlers/base.py.

It would enable an easier way to universally, dynamically wrap views with 
for instance context managers, a process which doesn't really exist today: 
To do this with a view middleware would mean not being able to use another 
view middleware, to use process_request & process_response would mean not 
being certain "__exit__" was called.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/67ee3167-8030-4946-a24d-580b4724ca0e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to