def __init__(self): self.hide = [] modname = whichplugin() logging.debug("persistconfig - module name is %s" % modname) Config.__init__(self, 'plugs' + os.sep + modname, "config") self.modname = modname self.plugname = self.modname.split('.')[-1] cmndname = "%s-cfg" % self.plugname logging.debug('persistconfig - added command %s (%s)' % (cmndname, self.plugname)) from tl.lib.commands import cmnds, Command cmnds[cmndname] = Command(self.modname, cmndname, self.cfg, ['OPER', ]) examples.add(cmndname, "%s configuration" % self.plugname, cmndname) cmndnamesave = cmndname + "save" cmnds[cmndnamesave] = Command(self.modname, cmndnamesave, self.cfgsave, ['OPER',]) examples.add(cmndnamesave, "save %s configuration" % self.plugname, cmndnamesave) cmndnamedef = cmndname + "defined" cmnds[cmndnamedef] = Command(self.modname, cmndnamedef, self.cfgdefined, ['OPER',]) examples.add(cmndnamedef, "show defined config vars for %s plugin" % self.plugname, cmndnamedef)
def __init__(self, descr, ex, url=False, modname=None): self.descr = descr self.example = ex self.url = url self.modname = modname or whichplugin(2)