Django

Code

Changeset 3595

Show
Ignore:
Timestamp:
08/16/06 07:52:35 (2 years ago)
Author:
utrebec
Message:

[full-history]
* Added a "signal_name" argument to "pre_save" and "pre_delete" signals
(I use it so I can use single function to catch both signals and still
do different things with them)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/full-history/django/db/models/base.py

    r3580 r3595  
    161161 
    162162    def save(self): 
    163         dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self
     163        dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self, signal_name='pre_save'
    164164 
    165165        non_pks = [f for f in self._meta.fields if not f.primary_key] 
  • django/branches/full-history/django/db/models/query.py

    r3426 r3595  
    922922        # Pre notify all instances to be deleted 
    923923        for pk_val, instance in seen_objs[cls]: 
    924             dispatcher.send(signal=signals.pre_delete, sender=cls, instance=instance
     924            dispatcher.send(signal=signals.pre_delete, sender=cls, instance=instance, signal_name='pre_delete'
    925925 
    926926        pk_list = [pk for pk,instance in seen_objs[cls]]