On Tue, 2007-03-27 at 19:39 +0000, Mario Gonzalez wrote: > On Mar 27, 2:13 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > Also, keep in mind that writing a 'process_view' method instead will > > give you access to the view function the URL resolved to, and will > > execute *before* the view function is actually called. That might be > > I changed and I've got the same name '_wrapped_view'. I think I must > going to include the resolv() rutine inside my code. I'm not sure but > I believe wrapped_view it's something like a pointer. > > class AuthorizedMiddleware(object): > > def process_view(self, request, view, args, kwargs): > return HttpResponse(str( view.__name__ ))
This is a known mini-problem and something we need to / will sort out prior to 1.0. There are a *lot* of places in Django that wrap views up and then expose them to the world. Once you get used to the idiom, it's not a bad way of programming, although it does make your brain leak out your ears sometimes trying to work out who is actually doing the real work. The drawback of this approach is that it's hard to get access to the underlying function. At the moment we try to remember to fill in most of the details on the wrapped object, but this isn't always possible (for example, the __name__ attribute of a function is read-only in python 2.3). One solution that has been proposed is to include the third-party decorator module in Python, which takes care of a bunch of that work. There's been no firm decision on that yet, but it's something we will deal with prior to 1.0 -- I think it's practical that we should be able to get a firm decision made on almost every existing open ticket prior to 1.0 that isn't a "some day maybe" enhancement request. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---