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
예제 #2
0
 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
예제 #4
0
 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)
예제 #6
0
 def visitfile(self, fname):                     
     FileVisitor.visitfile(self, fname)
     if self.listonly:
         return
     os.chmod(fname, 0777)
예제 #7
0
 def __init__(self, listonly=0):    
     FileVisitor.__init__(self, listonly=listonly) 
 def __init__(self, fromDir, toDir):
     self.fromDirLen = len(fromDir) + 1
     self.toDir      = toDir
     FileVisitor.__init__(self)