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 visitfile(self, fname): FileVisitor.visitfile(self, fname) if self.listonly: return os.chmod(fname, 0777)