def notify(self, *args, **kwargs):
"""
Call all listener callbacks. The wrapped function is not executed.
"""
for listener in self.nm_listeners:
# Ensure that all callbacks get called, and no exceptions escape to
# the caller.
try:
listener(*args, **kwargs)
except:
# If the target is a notify_callback--which should always be
# the case as long as the proper API is used--show the actual
# function
target = getattr(listener, 'nc_func', listener)
print >>sys.stderr, 'Exception in notification %s:' % (repr(target),)
traceback.print_exception(*sys.exc_info())
评论列表
文章目录