Hey all —

I wanted to get some feedback on a patch [1] I wrote for #9015. I am on board 
with the notion decorators can be used for registration patterns. Recently, 
I've been using signals a bit more which has spiked my interest in this ticket. 
Since Django 1.2 has a Python 2.4 minimum requirement and we're before the 
feature freeze I figured I'd take a stab at it.

The approach I took was slightly different than what zvoase took in his 
patches. I felt that using the connect method of Signal would be risky 
business. It is stable API that I didn't want to go modifying. Also, the idea 
of the decorator is to only connect which makes other methods on the signal 
useless. I appreciate the work zvoase did though, so thanks!

My approach introduces new API @receiver from django.dispatch. It takes the 
signal and kwargs and calls connect appropriately. Here's a quick example:

from django.db.models.signals import pre_save
from django.dispatch import receiver

@receiver(pre_save, sender=MyModel)
def my_receiver(sender, **kwargs):
    ...

Any thoughts or objections to committing?

[1]: 
http://github.com/brosner/django-svn/commit/970dcae959af16699b78ebca13ac878a6ffe86a7

-- 
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.

Reply via email to