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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def visitfile(self, fname):                     
     FileVisitor.visitfile(self, fname)
     if self.listonly:
         return
     os.chmod(fname, 0777)
Ejemplo n.º 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)