def StoreData(lockFile, lockedFilesList): "Store locking information into the file" encodefilename, decodefilename = store._buildencodefun() outputF = open(lockFile,"w") os.chmod(lockFile, 0664) for file in lockedFilesList.keys(): outputF.write(encodefilename(file) + ":" + ":".join(lockedFilesList[file]) + newLine) outputF.close()
def LoadData(lockFile): "Load data from file" encodefilename, decodefilename = store._buildencodefun() lockedFilesList = dict() if os.path.exists(lockFile): for line in open(lockFile): line = line.strip() file,user,date=line.split(":",2) file = decodefilename(file) lockedFilesList[file] = (user,date) return lockedFilesList