I'm sure I made some dumb mistake, but I just can't see it. Basically, I'm having difficulty connecting to the signal with my model.
#my test def test_set_trigger_bug(self): self.assertEqual(len(game_reset.receivers), 0) def trigger(): pass game_reset.connect(trigger) self.assertEqual(len(game_reset.receivers), 1) game_reset.disconnect(trigger) self.assertEqual(len(game_reset.receivers), 0) game_reset_event = GameResetEvent(game = self.game) game_reset_event.save() game_reset_event.set_trigger(trigger) self.assertEqual(len(game_reset.receivers), 1) #this fails saying the number of receivers is still 0 #if you comment out the previous assertion, the rest of this works: def set_trigger(trigger): game_reset.connect(trigger) set_trigger(trigger) self.assertEqual(len(game_reset.receivers), 1) #my model class GameResetEvent( EventStrategy, models.Model): game = models.ForeignKey("Game") def set_trigger( self, trigger): game_reset.connect(trigger) def passes_filter( self, signal, sender, **kwargs): return sender.id == self.game.id class EventStrategy: def set_trigger( self, trigger): pass def passes_filter(signal, sender, **kwargs): pass #my signal definition game_reset =django.dispatch.Signal() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---