def storeMail(self, app, mailContents): localFileName = "batchreport." + app.name + app.versionSuffix() collFile = os.path.join(app.writeDirectory, localFileName) self.diag.info("Sending mail to", collFile) file = plugins.openForWrite(collFile) file.write(mailContents) file.close()
def performAllFilterings(self, test, stem, fileName, newFileName): currFileName = fileName filters = self.makeAllFilters(test, stem, test.app) for fileFilter, extraPostfix in filters: writeFileName = newFileName + extraPostfix self.diag.info("Applying " + fileFilter.__class__.__name__ + " to make\n" + writeFileName + " from\n " + currFileName) if os.path.isfile(writeFileName): self.diag.info("Removing previous file at " + writeFileName) os.remove(writeFileName) currFile = open(currFileName, "rU") # use universal newlines to simplify writeFile = plugins.openForWrite(writeFileName) fileFilter.filterFile(currFile, writeFile) writeFile.close() currFileName = writeFileName if len(filters) > 0 and currFileName != newFileName: shutil.move(currFileName, newFileName)