def visitfile(self, fname): # or use find.find list FileVisitor.visitfile(self, fname) if self.listonly: return if os.path.splitext(fname)[1] in fixext: text = open(fname, 'r').read() if string.find(text, oldsite) != -1: text = string.replace(text, oldsite, newsite) open(fname, 'w').write(text) self.changed.append(fname) for word in warnof: if string.find(text, word) != -1: self.warning.append(fname); break
def visitfile(self, fname): # or use find.find list FileVisitor.visitfile(self, fname) if self.listonly: return if os.path.splitext(fname)[1] in fixext: text = open(fname, 'r').read() if string.find(text, oldsite) != -1: text = string.replace(text, oldsite, newsite) open(fname, 'w').write(text) self.changed.append(fname) for word in warnof: if string.find(text, word) != -1: self.warning.append(fname) break
def __init__(self, listonly=0): # replace oldsite refs FileVisitor.__init__(self, listonly=listonly) # in all web text files self.changed, self.warning = [], [] # need diff lists here
def __init__(self, fromDir, toDir): self.fromDirLen = len(fromDir) + 1 self.toDir = toDir FileVisitor.__init__(self)
def visitfile(self, fname): FileVisitor.visitfile(self, fname) if self.listonly: return os.chmod(fname, 0777)
def __init__(self, listonly=0): FileVisitor.__init__(self, listonly=listonly)