Signal Connection Decorators

7 views
Skip to first unread message

Zachary Voase

unread,
Mar 19, 2009, 2:43:41 PM3/19/09
to Django developers
I spoke about this on here a while ago, but seeing as the 1.1 feature
freeze is looming, I thought it would be a good idea if I brought it
up again.

I think it's a good idea to have some support for using Python's
decorator syntax on signal receivers; seeing as Django's probably
going to switch to a 2.4+ requirement some time in the not-too-distant-
future, now seems as good a time as ever to add this support.

I've written a small patch and demonstration[1] which shows what this
might involve. My original idea has changed considerably since I last
posted on here; aside from just having simple signal connection, I've
also done a bit of hacking in the ModelBase metaclass so that each
model gets a 'signals' attribute with decorators for connecting
receivers; consult [1] for more information on the implementation and
what it would look like in code. At the moment I've tested this out a
little on my local SVN checkout (as you can see I was using r10008),
and it seems to be functional. Could someone please review this so
that we can make some ground on the matter? Thanks a lot,

Regards,
Zack

.. [1]: http://gist.github.com/81989

Alex Gaynor

unread,
Mar 19, 2009, 3:07:54 PM3/19/09
to django-d...@googlegroups.com
One thing at a time please.  I think having signal connections as a decorator is a good idea, but the ModelSignals thing is a totally seperate idea and, IMO, needs to go through the standard feature proposal phase in the release and thus for that part of this it's a really bad time for a proposal.

Alex

--
"I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire
"The people's good is the highest law."--Cicero
Reply all
Reply to author
Forward
0 new messages