On 16 jun, 15:45, Ben Firshman <b...@firshman.co.uk> wrote:
> The request is passed round so methods look like views to decorators. 
> Magically dropping it for decorators seems a bit scary. :/

Just brainstorming: couldn't you have View derive from HttpRequest?
Then you get a request object as the first parameter of methods, and
you can apply decorators to them (untested):

class View(HttpRequest):
    def __new__(cls, request, *args, **kwargs):
        """
        make sure not to call HttpRequest.__init__ on the request
again,
        since it has already been initialized
        """
        request.__class__ = cls         # or maybe make a copy of
request first
        return request(*args, **kwargs)

    @login_required
    def __call__(request, *args, **kwargs):
        return HttpResponse('')

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@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