RobertKolner / django-signal-disabler

Temporarily disable execution of django signals
MIT License
12 stars 3 forks source link

post_delete receiver disappeared #1

Open tumb1er opened 6 years ago

tumb1er commented 6 years ago
with signal_disabler.disable():
    obj.delete()
# at this line my listeners are not in `post_delete._live_receivers()` anymore 
# (and still here in post_delete.receivers)

It looks like Django clears dead receiver while sending corresponding signal, thus this entire package works incorrectly.

anx-ckreuzberger commented 5 years ago

I seem to have met the same problem (although I use a slightly different implementation). I also believe that is strongly correlated with the .delete() call.

anx-ckreuzberger commented 5 years ago

Seems like this is the solution to the problem: https://github.com/FactoryBoy/factory_boy/blob/ae780a38c2311cf6d306797889f09db4d395a6d4/factory/django.py#L297-L301