On Tue, Oct 5, 2010 at 5:43 AM, George Sakkis <george.sak...@gmail.com> wrote: > On Oct 4, 10:55 pm, "David P. Novakovic" <davidnovako...@gmail.com> > wrote: >> On Tue, Oct 5, 2010 at 5:21 AM, George Sakkis <george.sak...@gmail.com> >> wrote: >> >> > Since dispatch is going to be defined on the base View class, can't we >> > omit it from the urlconf and have the URLresolver do: >> >> > if isinstance(view, type) and issubclass(view, View): >> > view = view.dispatch >> >> Russ mentioned this one can't be decorated. > > What does "this" refer to here ? It's just a shortcut for the common > case, you can always decorate the SomeClassView.dispatch: > > url("^articles1/$", ArticlesView.dispatch), # > undecorated > url("^articles2/$", login_required(ArticlesView.dispatch)), # > decorated > > url("^articles3/$", ArticlesView), # shortcut of the > first > # url("^articles4/$", login_required(ArticlesView)), # this doesn't > work > > There is an asymmetry here but that's not to say it can't be > decorated, you just have to decorate the dispatch method instead of > the class view.
Yes, but that's the sort of asymmetry I'd like to avoid if possible. It's easy to document that you can wrap a decorator around anything you can put in a URL pattern. When you start making exceptions, then you have to explain the exceptions, and then explain to the people who don't read and/or understand the explanation... and so on. Yours, Russ Magee %-) -- 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.