def execute_plugins(self, network, trigger, *arguments): for plugin in plugin_handler.all_plugins(): try: if plugin.__class__.__dict__.has_key(trigger): # FIXME this is rather ugly, for compatiblity with pynik if plugin.__class__.__dict__[trigger].func_code.co_argcount == len(arguments) + 2: plugin.__class__.__dict__[trigger](plugin, self, *arguments) # Call without network elif plugin.__class__.__dict__[trigger].func_code.co_argcount == len(arguments) + 3: plugin.__class__.__dict__[trigger](plugin, self, *arguments, **{'network': network}) else: raise NotImplementedError("Plugin '%s' argument count missmatch, was %s." % ( plugin, plugin.__class__.__dict__[trigger].func_code.co_argcount)) except: error_handler.output_message("%s %s Plugin '%s' threw exception, exinfo: '%s', traceback: '%s'" % ( datetime.datetime.now().strftime("[%H:%M:%S]"), network, plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2]))) if trigger != "timer_beat": try: self.tell(self.settings.admin_network, self.settings.admin_channel, "%s %s Plugin '%s' threw exception, exinfo: '%s', traceback: '%s'" % ( datetime.datetime.now().strftime("[%H:%M:%S]"), network, plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])[::-1])) except: error_handler.output_message("%s %s Unable to send exception to admin channel, exinfo: '%s', traceback: '%s'" % ( datetime.datetime.now().strftime("[%H:%M:%S]"), network, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])))
def execute_plugins(self, trigger, *arguments): for plugin in plugin_handler.all_plugins(): try: plugin.__class__.__dict__[trigger](plugin, self, *arguments) except KeyError: pass except: print "argh", plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])
def execute_plugins(self, trigger, *arguments): for plugin in plugin_handler.all_plugins(): try: plugin.__class__.__dict__[trigger](plugin, self, *arguments) except KeyError: pass except: print "argh", plugin, sys.exc_info(), traceback.extract_tb( sys.exc_info()[2])
def execute_plugins(self, trigger, *arguments): for plugin in plugin_handler.all_plugins(): try: #if arguments: # print trigger # print("plugin.%s(self, %s)" % (trigger,", ".join(arguments))) #else: # print("plugin.%s(self)" % trigger) plugin.__class__.__dict__[trigger](plugin, self, *arguments) except KeyError: pass except: print "argh", plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])
def execute_plugins(self, trigger, event = {}): for plugin in plugin_handler.all_plugins(): try: if plugin.__class__.__dict__.has_key(trigger): event['bot'] = self plugin.__class__.__dict__[trigger](plugin, event) # new object based callback except: messages = ['','EXCEPTION:'] messages.append("%s %s" % (plugin, sys.exc_info())) for row in [[tb[0]+':'+str(tb[1])]+[str(z) for z in tb[2:]] for tb in traceback.extract_tb(sys.exc_info()[2])]: messages.append(row) messages.append('') for message in messages: error_handler.output_message(message)
def execute_plugins(self, network, trigger, *arguments): for plugin in plugin_handler.all_plugins(): try: if plugin.__class__.__dict__.has_key(trigger): # FIXME this is rather ugly, for compatiblity with pynik if plugin.__class__.__dict__[ trigger].func_code.co_argcount == len( arguments) + 2: plugin.__class__.__dict__[trigger]( plugin, self, *arguments) # Call without network elif plugin.__class__.__dict__[ trigger].func_code.co_argcount == len( arguments) + 3: plugin.__class__.__dict__[trigger](plugin, self, *arguments, **{ 'network': network }) else: raise NotImplementedError( "Plugin '%s' argument count missmatch, was %s." % (plugin, plugin.__class__.__dict__[trigger]. func_code.co_argcount)) except: error_handler.output_message( "%s %s Plugin '%s' threw exception, exinfo: '%s', traceback: '%s'" % (datetime.datetime.now().strftime("[%H:%M:%S]"), network, plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2]))) if trigger != "timer_beat": try: self.tell( self.settings.admin_network, self.settings.admin_channel, "%s %s Plugin '%s' threw exception, exinfo: '%s', traceback: '%s'" % (datetime.datetime.now().strftime("[%H:%M:%S]"), network, plugin, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])[::-1])) except: error_handler.output_message( "%s %s Unable to send exception to admin channel, exinfo: '%s', traceback: '%s'" % (datetime.datetime.now().strftime("[%H:%M:%S]"), network, sys.exc_info(), traceback.extract_tb(sys.exc_info()[2])))