Hi all,

I need to fix #6371 [1], and I've found a nice way to do it (something like 
[2]).

However, decorator_from_middleware is a pain, since it doesn't always return a 
an actual decorator, for "historical reasons".  I need to change this to fix 
the bug.  Is anyone against this?

decorator_from_middleware isn't actually documented anywhere, but I'm guessing 
it might be used outside of the Django code base.  I want to change it as 
follows.

For decorators like gzip_page, everything works as normal:

  gzip_page = decorator_from_middleware(GzipMiddleware)

The only difference is that gzip_page is now a true decorator.

For decorators which require arguments given to the middleware, you will now 
need to use decorator_from_middleware_with_args.

I will manually fix the one decorator this breaks (cache_page) to provide 
backwards compatibility with the published documentation.

Does anyone object to this change?  It makes fixing #6371 a *lot* easier.  In 
fact I can't actually get my head around how to fix it at all without the 
change.

Luke


[1] http://code.djangoproject.com/ticket/6371
[2] http://stackoverflow.com/questions/1288498/using-the-same-decorator-with-
arguments-with-functions-and-methods/1288936#1288936

-- 
Parenthetical remarks (however relevant) are unnecessary

Luke Plant || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to