Ejemplo n.º 1
0
Archivo: users.py Proyecto: code2u/jsb
 def __init__(self, filename):
     self.userhosts = {}
     self.masks = {}
     self.compiled = {}
     Persist.__init__(self, filename)
     if not self.data:
         self.data = []
     for i in self.data:
         for j in i.userhosts:
             self.adduserhost(j, i)
Ejemplo n.º 2
0
Archivo: todo.py Proyecto: code2u/jsb
 def __init__(self, filename):
     Persist.__init__(self, filename)
     if not self.data:
         return
     for key in self.data.keys():
         todoos = self.data[key]
         for (k, v) in todoos.data.items():
             v.num = k
         newd = Todolist()
         for i in todoos:
             newd.append(i)
         self.data[key] = newd
Ejemplo n.º 3
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
     logging.info("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)
Ejemplo n.º 4
0
 def syncold(self, filename, remove=False):
     """ sync with old config data """
     if os.path.isfile(filename):
         synckey = "persistconfig-syncold"
         oldconfig = Persist(filename)
         if not oldconfig.data.has_key(synckey):
             logging.warn("syncing old config %s with persistconfig" % filename)
             for i, j in oldconfig.data.iteritems():
                 if i == synckey:
                     continue
                 if j and not self.get(i):
                     self.set(i, oldconfig.data[i])
             oldconfig.data[synckey] = time.localtime()
             oldconfig.save()
         del oldconfig
         if remove:
             os.unlink(filename)
Ejemplo n.º 5
0
Archivo: pdod.py Proyecto: code2u/jsb
 def save(self):
     Persist.save(self)
Ejemplo n.º 6
0
Archivo: pdod.py Proyecto: code2u/jsb
 def __init__(self, filename):
     Persist.__init__(self, filename)
     if not self.data:
         self.data = {}