Last active
August 29, 2015 14:19
-
-
Save Cediddi/e914686397d85b0d470c to your computer and use it in GitHub Desktop.
Isolate signal from dispatcher. Useful for unwanted recursive save signals.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isolate(func): | |
def _func(sender, instance, **kwargs): | |
kwargs["signal"].disconnect(_func, sender=sender) | |
func(sender, instance, **kwargs) | |
kwargs["signal"].connect(_func, sender=sender) | |
return _func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment