Created
September 17, 2010 21:02
-
-
Save ojii/584951 to your computer and use it in GitHub Desktop.
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
from django.utils import importlib | |
def lazy_listen(signal, reciever, sender=None): | |
if sender and isinstance(sender, basestring): | |
module, obj = sender.rsplit('.', 1) | |
mod = importlib.import_module(module) | |
sender = getattr(mod, obj) | |
signal.connect(reciever, sender=sender) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment