On donderdag 19 juli 2018 18:22:46 CEST lorin...@gmail.com wrote: > Is there any way to disable dispatching of signals? > If not, I truly truly think there should be a way to do it :) > > Possible use cases: > - Prevent signals being called recursively because the signal code > dispatched the same signal.
Subscribe to the signal with dispatch_uid[1]. > - Disable for scripts or management commands > - Just bypass the signals on specific actions. As Jason implies: both tasks of the observer, not the dispatcher. If a dispatcher does not call all registered observers as part of the API contract, you have no way to debug it (given that a signal dispatcher should be a black box to you) or at best you'd have 2 places where things can go wrong instead of just one. You thought up some use cases, but given the tone of your mail you mybe spent some time trying to shoehorn some code into a signal/observer pattern? Perhaps it's not the right fit for your problem. -- Melvyn Sopacua -------- [1] https://docs.djangoproject.com/en/2.0/topics/signals/#preventing-duplicate-signals -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6325556.ifQiiisRDa%40fritzbook. For more options, visit https://groups.google.com/d/optout.