Esempio n. 1
0
 def _register(watch_states, notifier, cb):
     registered = []
     try:
         for s in watch_states:
             if not notifier.is_registered(s, cb):
                 notifier.register(s, cb)
                 registered.append((s, cb))
     except ValueError:
         with excutils.save_and_reraise_exception():
             for (s, cb) in registered:
                 notifier.deregister(s, cb)
Esempio n. 2
0
def _bulk_deregister(notifier, registered, details_filter=None):
    """Bulk deregisters callbacks associated with many states."""
    while registered:
        state, cb = registered.pop()
        notifier.deregister(state, cb,
                            details_filter=details_filter)
Esempio n. 3
0
def _bulk_deregister(notifier, registered, details_filter=None):
    """Bulk deregisters callbacks associated with many states."""
    while registered:
        state, cb = registered.pop()
        notifier.deregister(state, cb,
                            details_filter=details_filter)
Esempio n. 4
0
 def _deregister(watch_states, notifier, cb):
     for s in watch_states:
         notifier.deregister(s, cb)