#22657: Can't disconnect signal if connected using @reeiver tag -------------------------------------+------------------------------------- Reporter: michalsicker@… | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.6 (models, ORM) | Keywords: @receiver signal Severity: Normal | disconnect Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- I got signal handler function hooked to pre_save signal using @receiver.
When I tried to disconnect that signal handler temporarily in TestCase, I couldn't achieve that. The lookup key generated in dispatcher (lookup_key = (_make_id(receiver), _make_id(sender))) in order to match function which should be disconnected has other value than it should have so the function can't be found in self.receivers and handler doesn't get disconnected. That's probably because in self.receivers there is a lookup key generated based on "wrapper" function which had been taken to generate that lookup when registering handler, not the original one, that's why importing original function and passing it to .disconnect() doesn't work. When signal connected without using @receiver but using pre_save.connect it works as expected. -- Ticket URL: <https://code.djangoproject.com/ticket/22657> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.e1248a33470ac6d47ec2b567a13c7cf5%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.