#32054 closed Bug (needsinfo)
Signal disconnect not working with multiple decorators
Reported by: | Ronny Vedrilla | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.0 |
Severity: | Normal | Keywords: | signals |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Here's my setup on django 3.0.10:
class MyModel(models.Model): pass @receiver(post_save, sender=MyModel) @receiver(post_delete, sender=MyModel) def process_stuff(sender, instance, **kwargs): # to some magic pass
When I want to disconnect the post_save signal like this:
from django.db.models import signals signals.post_save.disconnect( receiver=process_stuff, sender=MyModel,
... it does not work.
If I comment out the second decorator with post_delete
, it works.
If I split this up and use two different functions, it works as well.
I posted at StackOverflow (https://stackoverflow.com/q/64102708/1331671) and in some django groups, but no replies yet.
Seems like a bug to me :(
Change History (5)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 by , 4 years ago
Resolution: | invalid |
---|---|
Status: | closed → new |
Hi @carton
sorry for not having made myself clear. I do think this is a bug. The docs state explicitly that you can use multiple receivers on a function but the disconnect is not working in this case.
Or am I missing something?
Thanks!
Ronny
comment:4 by , 4 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
There's not enough info here for a bug report. (There's not enough info on the SO question to solicit an answer for that matter.)
You need to provide a minimal reproduce example demonstrating what you think is the issue. (It's very likely that in coming up with that you identify your problem.)
As it stands you're asking for help, which is fine, in a single place, but is not appropriate for the issue tracker.
I do hope that makes sense. See TicketClosingReasons/UseSupportChannels
Sorry, the issue tracker is not a secondary support channel. Please see TicketClosingReasons/UseSupportChannels.
You've done the right thing posting elsewhere (although multiple posting is bad-form) You should wait for a reply, or try to investigate more to help people answer.
If you are able to narrow down a specific issue/behaviour/change then it might be appropriate as a bug report but it's a usage question as it stands.
I hope that makes sense.