def GetUploadDirs(self, filelist): """ When uploading all files, do NOT use this, use GenerateFileList instead. This is only when we have a small list of files which may point to various directories. """ for afile in filelist: uploaddir = self.GetUploadDirName(os.path.dirname(afile)) if not uploaddir in self.dirlist and not fileutils.isHidden(uploaddir): self.dirlist.append(uploaddir)
def GenerateFileList(self, indir): if self.useSearch == 0 and string.find(indir, "cgi-bin") != -1: return uploaddir = self.GetUploadDirName(indir) if not uploaddir in self.dirlist: self.dirlist.append(uploaddir) for item in os.listdir(indir): myitem = os.path.join(indir, item) if os.path.isfile(myitem) and not fileutils.isHidden(myitem) and string.find(item, "Karrigell") == -1 and string.find(item, "httpserver") == -1 and string.find(item, "ftppass.txt") == -1: finalname = string.replace(myitem, self.rootdir, "") if wx.Platform == "__WXMSW__": finalname = string.replace(finalname, "\\", "/") #finalname = string.replace(finalname, os.pathsep, "/") if not self.useSearch and string.find(myitem, "cgi-bin") == -1: # TODO: test for extensions instead of this if string.find(item, ".dll") == -1 and string.find(item, ".pyd") == -1 and string.find(item, ".exe") == -1: self.filelist.append(finalname) else: self.filelist.append(finalname) elif os.path.isdir(myitem): self.GenerateFileList(myitem)