Esempio n. 1
0
def setPermAccess(conference, jid, level=0):
    gPermAccess[conference][jid] = None
    if level:
        gPermAccess[conference][jid] = level
    else:
        del gPermAccess[conference][jid]
    path = getConfigPath(conference, ACCESS_FILE)
    io.dump(path, gPermAccess[conference])
Esempio n. 2
0
def setPermAccess(conference, jid, level=0):
    gPermAccess[conference][jid] = None
    if level:
        gPermAccess[conference][jid] = level
    else:
        del gPermAccess[conference][jid]
    path = getConfigPath(conference, ACCESS_FILE)
    io.dump(path, gPermAccess[conference])
Esempio n. 3
0
def setPermGlobalAccess(jid, level=0):
    path = getConfigPath(ACCESS_FILE)
    tempAccess = io.load(path)
    tempAccess[jid] = None
    gGlobalAccess[jid] = None
    if level:
        tempAccess[jid] = level
        gGlobalAccess[jid] = level
    else:
        del tempAccess[jid]
        del gGlobalAccess[jid]
    path = getConfigPath(ACCESS_FILE)
    io.dump(path, tempAccess)
Esempio n. 4
0
def setPermGlobalAccess(jid, level=0):
    path = getConfigPath(ACCESS_FILE)
    tempAccess = io.load(path)
    tempAccess[jid] = None
    gGlobalAccess[jid] = None
    if level:
        tempAccess[jid] = level
        gGlobalAccess[jid] = level
    else:
        del tempAccess[jid]
        del gGlobalAccess[jid]
    path = getConfigPath(ACCESS_FILE)
    io.dump(path, tempAccess)
Esempio n. 5
0
def convert_txt(dir, dbname):
    try:
        oldpath = r"%s/%s.txt" % (dir, dbname)
        if not os.path.exists(oldpath):
            print "not found: %s" % (oldpath)
            return

        print "convert txt %s" % (dbname)

        newpath = r"%s/%s.dat" % (dir, dbname)

        data = eval(io.read(oldpath))
        if '' in data:
            print "empty key"
            del data['']
        io.dump(newpath, data)
        os.remove(oldpath)
    except IOError:
        print "not found"
Esempio n. 6
0
	def saveMacroses(self, conference=None):
		if conference:
			path = os.path.join(self.path, conference, MACROS_FILE)
			io.dump(path, self.macrosList[conference])

			path = os.path.join(self.path, conference, MACCESS_FILE)
			io.dump(path, self.accessList[conference])
		else:
			path = os.path.join(self.path, MACROS_FILE)
			io.dump(path, self.gMacrosList)

			path = os.path.join(self.path, MACCESS_FILE)
			io.dump(path, self.gAccessList)
Esempio n. 7
0
def merge_autoroles(dir):

    db1path = r"%s/moderators.txt" % (dir)
    db2path = r"%s/visitors.txt" % (dir)

    if not (os.path.exists(db1path) or os.path.exists(db2path)):
        return

    print "merge"

    dbnewpath = r"%s/autoroles.dat" % (dir)

    data1 = eval(io.read(db1path))
    data2 = eval(io.read(db2path))

    data = {}
    for k in data1:
        data[k] = "moder"
    for k in data1:
        data[k] = "visitor"
    io.dump(dbnewpath, data)
    os.remove(db1path)
    os.remove(db2path)
Esempio n. 8
0
def convert_db(dir, dbname):
    try:
        olddbpath = r"%s/%s.txt" % (dir, dbname)
        oldtimepath = r"%s/%s.txt.db" % (dir, dbname)

        if not os.path.exists(olddbpath):
            print "not found: %s" % (olddbpath)
            return

        print "convert db %s" % (dbname)

        newdbpath = r"%s/%s.dat" % (dir, dbname)
        newtimepath = r"%s/%s.dat.db" % (dir, dbname)

        data = eval(io.read(olddbpath, "{}"))
        time = eval(io.read(oldtimepath, "{}"))

        io.dump(newdbpath, data)
        io.dump(newtimepath, time)
        os.remove(olddbpath)
        os.remove(oldtimepath)
    except IOError:
        print "not found"
Esempio n. 9
0
def saveConferenceConfig(conference):
    path = getConfigPath(conference, CONFIG_FILE)
    io.dump(path, gConferenceConfig[conference])
Esempio n. 10
0
	def save(self):
		io.dump(self.path, self.base)
		io.dump(self.ctpath, self.changes)
Esempio n. 11
0
def saveConferenceConfig(conference):
    path = getConfigPath(conference, CONFIG_FILE)
    io.dump(path, gConferenceConfig[conference])