#NEWLINE# def fire( self , name , * params ) : #NEWLINE# #INDENT# 'Calls all callbacks with given event name.\n\n        Keyword arguments:\n          name -- Event name to fire.\n          params -- Params to pass to callbacks.\n\n        Raises:\n          EventDoesNotExistError -- If fire is called a nonexistent event.\n\n        Returns:\n          boolean -- Whether a callback (or multiple) was called successfully.\n        ' #NEWLINE# self . logger . debug ( ( 'Attempting to fire event: %s' % name ) ) #NEWLINE# if ( name not in self . registered_events ) : #NEWLINE# #INDENT# self . logger . debug ( ( 'Event does not exist: %s' % accepted ) ) #NEWLINE# raise EventDoesNotExistError ( ( "Can't call an event that does not exist: %s" % name ) ) #NEWLINE# #UNINDENT# callbacks = self . registered_callbacks [ name ] #NEWLINE# self . logger . debug ( ( 'Calling %d callbacks for event: %s' % ( len ( callbacks ) , name ) ) ) #NEWLINE# accepted = False #NEWLINE# for ( callback_id , callback ) in callbacks . iteritems ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# callback ( self . cardinal , * params ) #NEWLINE# self . logger . debug ( ( 'Callback %s accepted event: %s' % ( callback_id , name ) ) ) #NEWLINE# accepted = True #NEWLINE# #UNINDENT# except EventRejectedMessage : #NEWLINE# #INDENT# self . logger . debug ( ( 'Callback %s rejected event: %s' % ( callback_id , name ) ) ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . logger . exception ( ( 'Exception during callback %s for event: %s' % ( callback_id , name ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return accepted