Thank you all for your replies. My search on the topic had missed
most
of the past discussion, which I'm now catching up on.
Carl Meyer wrote:
> > @method_decorator(permission_required, 'thing.change_thing')
>
> Is this really any better than
> @method_decorator(permission_required("thing.change_thing"))?
> The latter seems more explicit/clearer, and allows method_decorator to
> stay simpler.
No, of course you're right. The nature of decorators with arguments,
which are relly decorator factories, had somehow eluded me.
Łukasz Rekucki wrote:
> The super() problem actually makes a great Python puzzle so it's easy
> to remember the dangers after solving it ;)
A funny puzzle indeed. IMHO the root problem is Python 2's super()
requiring an explicit mention of the surrounding class, something I
never liked to begin with. It would seem the only correct way to
augment classes are mixins.
So until a newer Django release provides mixins (or dstufft's
universal
mixin-decorator classes) for all standard functionality, which seemed
to
be the consensus in the latest big thread, I will use a small utility
to
convert decorators to mixins as needed. I have attached it to the
issue
https://code.djangoproject.com/ticket/14512 in case someone wants to
use
it or augment the current documentation with it.
-Tobia
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.