def reloadcheck(self, bot, event, target=None): """ check if plugin need to be reloaded for callback, """ from boot import plugblacklist plugloaded = [] done = [] target = target or event.cbtype or event.cmnd if target in bot.nocbs: logging.warn("%s in nocbs list, skipping" % target) ; return if not event.cbtype == 'TICK': logging.debug("%s - checking for %s events" % (bot.cfg.name, target)) try: from boot import getcallbacktable p = getcallbacktable()[target] except KeyError: if not event.nolog: logging.debug("can't find plugin to reload for %s" % event.cmnd) return if not event.nolog: logging.debug("found %s" % unicode(p)) for name in p: if name in bot.plugs: done.append(name) ; continue if plugblacklist and name in plugblacklist.data: logging.info("%s - %s is in blacklist" % (bot.cfg.name, name)) continue elif bot.cfg.loadlist and name not in bot.cfg.loadlist: logging.info("%s - %s is not in loadlist" % (bot.cfg.name, name)) continue if not event.nolog: logging.debug("%s - on demand reloading of %s" % (bot.cfg.name, name)) try: mod = bot.plugs.reload(name, force=True, showerror=False) if mod: plugloaded.append(mod) ; continue except Exception, ex: handle_exception(event) if done and not event.nolog: logging.debug("%s - %s is already loaded" % (bot.cfg.name, str(done))) return plugloaded
def reloadcheck(self, event, target=None): """ check if plugin need to be reloaded for callback, """ from boot import plugblacklist plugloaded = [] target = target or event.cbtype or event.cmnd try: from boot import getcallbacktable p = getcallbacktable()[target] except KeyError: logging.debug("can't find plugin to reload for %s" % event.cmnd) return logging.debug("%s - checking %s" % (self.cfg.name, unicode(p))) for name in p: if name in self.plugs: logging.debug("%s - %s is already loaded" % (self.cfg.name, name)) continue if name in default_plugins: pass elif name in plugblacklist.data: logging.info("%s - %s is in blacklist" % (self.cfg.name, name)) continue elif self.cfg.loadlist and name not in self.cfg.loadlist: logging.info("%s - %s is not in loadlist" % (self.cfg.name, name)) continue logging.debug("%s - on demand reloading of %s" % (self.cfg.name, name)) try: mod = self.plugs.reload(name, force=True, showerror=False) if mod: plugloaded.append(mod) ; continue except Exception, ex: handle_exception(event) return plugloaded
def reloadcheck(self, event): """ check if plugin need to be reloaded for callback, """ plugloaded = [] target = event.cbtype or event.cmnd try: from boot import getcallbacktable p = getcallbacktable()[target] except KeyError: logging.debug("botbase - can't find plugin to reload for %s" % event.cmnd) return logging.debug("%s - checking %s" % (self.name, unicode(p))) for name in p: if name in self.plugs: continue if name in default_plugins: pass elif self.cfg.blacklist and name in self.cfg.blacklist: continue elif self.cfg.loadlist and name not in self.cfg.loadlist: continue logging.warn("%s - on demand reloading of %s" % (self.name, name)) try: mod = self.plugs.reload(name, force=True, showerror=False) if mod: plugloaded.append(mod) continue except Exception, ex: handle_exception(event)
def reloadcheck(self, bot, event, target=None): """ check if plugin need to be reloaded for callback, """ from boot import plugblacklist plugloaded = [] done = [] target = target or event.cbtype or event.cmnd if target in bot.nocbs: logging.warn("%s in nocbs list, skipping" % target) return if not event.cbtype == 'TICK': logging.debug("%s - checking for %s events" % (bot.cfg.name, target)) try: from boot import getcallbacktable p = getcallbacktable()[target] except KeyError: if not event.nolog: logging.debug("can't find plugin to reload for %s" % event.cmnd) return if not event.nolog: logging.debug("found %s" % unicode(p)) for name in p: if name in bot.plugs: done.append(name) continue if plugblacklist and name in plugblacklist.data: logging.info("%s - %s is in blacklist" % (bot.cfg.name, name)) continue elif bot.cfg.loadlist and name not in bot.cfg.loadlist: logging.info("%s - %s is not in loadlist" % (bot.cfg.name, name)) continue if not event.nolog: logging.debug("%s - on demand reloading of %s" % (bot.cfg.name, name)) try: mod = bot.plugs.reload(name, force=True, showerror=False) if mod: plugloaded.append(mod) continue except Exception, ex: handle_exception(event)