def add_to_tree(self, parent, name, user, tpathls): loginfo('add_to_tree:', mypprint.pformat(name)) loginfo('tpathls:', tpathls) if tpathls: tpath = '/' + '/'.join(tpathls) + '/' + name[0] else: tpath = '/' + name[0] loginfo('tpath:', tpath) p = self.add_tree_node(parent, name[0], user, tpath) if len(tpathls) == 1: if not self.usertree.has_key(tpathls[0]): self.usertree[tpathls[0]] = {} self.usertree[tpathls[0]][name[0]] = p tpathls.append(name[0]) for child in name[1]: self.add_to_tree(p, child, user, tpathls) tpathls.pop(-1)
def load(self): self.linkman = linkman.LinkMan(self.datadir) boxes = os.listdir(self.datadir) for box in boxes: if box.endswith(".bak"): # ignore dir name end with .bak continue conf_path = os.path.join(self.datadir, box, "config.db") if not os.path.isfile(conf_path): continue else: f = open(conf_path, "r") conf = pickle.load(f) f.close() mailinfo_path = os.path.join(self.datadir, box, "mailinfo.db") # mailinfo = dbtable.DBTable(mailinfo_path, self.mailinfo_fields, self.mailinfo_index) # userconf = {'config': conf, 'mailinfo':mailinfo} self.users[conf["name"]] = conf self.mailboxs[conf["email"]] = conf loginfo(mypprint.pformat(conf["mailbox"]))