我有一个发送信号的模型:
class WMTransaction(models.Model):
def save(self, *args, **kwargs):
if self.status == 'completed':
self.completed = datetime.datetime.now()
try:
old = WMTransaction.objects.get(pk=self.pk)
if old.status == 'processing':
print 'sending signal'
payment_done.send(self)
except:
pass
super(WMTransaction, self).save(*args, **kwargs)
我也有 2 个模块中的接收器:
@receiver(payment_done, dispatch_uid="make_this_signal_unique", weak=False)
def subscribe(sender, **kwargs):
print 'subscribing'
# processing
和:
@receiver(payment_done, dispatch_uid="this_signal_is_also_unique", weak=False)
def buy(sender, **kwargs):
print 'buying'
# processing
问题是订阅功能被调用,而购买- 不是......两个模块都在已安装的应用程序中,这些模块的其他功能正常工作。信号有什么问题?