예제 #1
0
    def __getattribute__(self, name):
        # make sure the attribute data is not called from Persist or 
        # PersistConfig returning a persist compatible (key, value) dict 
        # instead of the rich persistconfig
        cf = calledfrom(sys._getframe())
        ## (key, option(value, ...)) is only for persistconfig internal usage.
        if name == "data" and cf != "persistconfig" and cf != "persist" and \
cf != self.__basename__:
            # intercept data block, return a clean dict with lazy binding 
            # to option.value
            return LazyValueDict(self)
        return super(PersistConfig, self).__getattribute__(name)
예제 #2
0
 def start(self):
     self.name = calledfrom(sys._getframe(0))
     self.stop = False
     self.running = False
     self.handlers = {}
     self.webmods = {}
     self.state = ObjectState()
     self.state.define('whitelistenable', 0)
     self.state.define('whitelist', [])
     self.state.define('blacklist', [])
     self.state.define('disable', [])
     self.poll = select.poll()
     self.poll.register(self)
     start_new_thread(self.serve, ())
     time.sleep(1)
예제 #3
0
 def start(self):
     self.name = calledfrom(sys._getframe(0))
     self.stop = False
     self.running = False
     self.handlers = {}
     self.webmods = {}
     self.state = ObjectState()
     self.state.define('whitelistenable', 0)
     self.state.define('whitelist', [])
     self.state.define('blacklist', [])
     self.state.define('disable', [])
     self.poll = select.poll()
     self.poll.register(self)
     start_new_thread(self.serve, ())
     time.sleep(1)
예제 #4
0
    def __init__(self):
        self.__basename__ = self.__class__.__name__
        self.plugname = calledfrom(sys._getframe())
        Persist.__init__(self, os.path.join(datadir, "%s-config" % \
self.plugname), {})
        self.__callbacks = {}
        cmndname = "%s-cfg" % self.plugname
        rlog(-3, 'persistconfig', 'added command %s (%s)' % (cmndname, \
self.plugname))
        cmnds[cmndname] = Command(self.cmnd_cfg, 'OPER', self.plugname, \
threaded=True)	
        examples.add(cmndname, "plugin configuration", cmndname)
        cmndnamesave = cmndname + "save"
        cmnds[cmndnamesave] = Command(self.cmnd_cfgsave, 'OPER', \
self.plugname, threaded=True)	
        examples.add(cmndnamesave, "save plugin configuration", cmndnamesave)
예제 #5
0
    def __init__(self):
        self.hide = []
        self.plugname = calledfrom(sys._getframe())
        Config.__init__(self, datadir + os.sep + 'plugs' + os.sep + self.plugname, "config")

        if self.plugname not in config['loadlist']:
             return

        cmndname = "%s-cfg" % self.plugname
        rlog(-3, 'persistconfig', 'added command %s (%s)' % (cmndname, \
self.plugname))
        cmnds[cmndname] = Command(self.cmnd_cfg, 'OPER', self.plugname, \
threaded=True)	
        examples.add(cmndname, "plugin configuration", cmndname)
        cmndnamesave = cmndname + "save"
        cmnds[cmndnamesave] = Command(self.cmnd_cfgsave, 'OPER', \
self.plugname, threaded=True)	
        examples.add(cmndnamesave, "save plugin configuration", cmndnamesave)
예제 #6
0
    def __init__(self):
        self.hide = []
        self.plugname = calledfrom(sys._getframe())
        Config.__init__(self,
                        datadir + os.sep + 'plugs' + os.sep + self.plugname,
                        "config")

        if self.plugname not in config['loadlist']:
            return

        cmndname = "%s-cfg" % self.plugname
        rlog(-3, 'persistconfig', 'added command %s (%s)' % (cmndname, \
self.plugname))
        cmnds[cmndname] = Command(self.cmnd_cfg, 'OPER', self.plugname, \
threaded=True)
        examples.add(cmndname, "plugin configuration", cmndname)
        cmndnamesave = cmndname + "save"
        cmnds[cmndnamesave] = Command(self.cmnd_cfgsave, 'OPER', \
self.plugname, threaded=True)
        examples.add(cmndnamesave, "save plugin configuration", cmndnamesave)
예제 #7
0
 def __init__(self):
     PersistState.__init__(
         self, datadir + os.sep + calledfrom(sys._getframe(1)) + '.state')
예제 #8
0
 def __init__(self):
     self.plugname = calledfrom(sys._getframe())
     rlog(10, 'persiststate', 'iniitialising %s' % self.plugname)
     PersistState.__init__(
         self, datadir + os.sep + 'plugs' + os.sep + self.plugname +
         os.sep + 'state')
예제 #9
0
 def __init__(self):
     PersistState.__init__(self, datadir + os.sep + calledfrom(sys._getframe(1)) + ".state")
예제 #10
0
 def __init__(self):
     self.plugname = calledfrom(sys._getframe())
     rlog(10, "persiststate", "iniitialising %s" % self.plugname)
     PersistState.__init__(self, datadir + os.sep + "plugs" + os.sep + self.plugname + os.sep + "state")