#NEWLINE# def _bulk_register( watch_states , notifier , cb , details_filter = None ) : #NEWLINE# #INDENT# 'Bulk registers a callback associated with many states.' #NEWLINE# registered = [ ] #NEWLINE# try : #NEWLINE# #INDENT# for state in watch_states : #NEWLINE# #INDENT# if ( not notifier . is_registered ( state , cb , details_filter = details_filter ) ) : #NEWLINE# #INDENT# notifier . register ( state , cb , details_filter = details_filter ) #NEWLINE# registered . append ( ( state , cb ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# with excutils . save_and_reraise_exception ( ) : #NEWLINE# #INDENT# _bulk_deregister ( notifier , registered , details_filter = details_filter ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return state