Definitely +1 on this idea. It seems to me like the cleanest solution yet proposed insofar as it provides the desired new functionality while requiring very little change for current code.
Cheers, AT On Wed, Oct 12, 2011 at 5:31 PM, Donald Stufft <donald.stu...@gmail.com>wrote: > Sorry for the delay, > > Here's a possible method of handling the idea of adding the additional > functionality of things like requiring logins to both FBV's and CBV's in a > way that I feel is consistent with the methodologies of each of those types > (decorators for FBV, Mixins for CBV). > > This also keeps all the logic in one place. It allows for anyone (even > people using FBV's) to easily extend the decorators and create their own > versions of them, without having to rewrite the whole thing (which was one > of the major reasons I like CBV's). It shouldn't break anything, the tests > are passing and a functional test in a browser they all appear to be > working. > > https://github.com/dstufft/django/compare/master...mixin-decorators > > Thoughts? Good Idea? Bad Idea? > > On Thursday, September 22, 2011 at 2:49 AM, ptone wrote: > > > > On Sep 21, 8:44 am, Donald Stufft <donald.stu...@gmail.com> wrote: > > > > The goal is to provide a Mixin for class based views, a decorator for class > based views, a decorator for methods, and a decorator for functions, all > from the same codebase. > > Currently I have the decorator for classes working, and the mixin working. > I have the places where the other 2 will go but from a combination of not > being very good at decorators, and not feeling well I haven't finished it > yet. > > > I like the overall direction of this approach (mixin class as the root > container of functionality) - but a number of technical issues still > need to have a resolution demonstrated (ie the decorating function > behavior) > > One, perhaps pony, of a universal approach, would be to convert the > decorator kwargs into class attributes, so that they could be > overriden in subclasses of a decorated parent, something easy to do > with mixins as the starting point. > > Also on a somewhat related note, a better option for middleware > process_view to interact with class based views > > -Preston > > -- > 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. > > > -- > 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. > -- 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.