def createFile(self, path):
     self.path = path
     tree = etree.Element("documents")
     file = File(path)
     content = etree.tostring(tree, xml_declaration=True, pretty_print=True, encoding="utf-8")
     print(content.decode("utf-8"))
     file.createFile()
     file.writeContent(content.decode("utf-8"))
Exemple #2
0
    def writeContent(self, path):

        file = File(path)

        content = {"title": self._title}
        jsonContent = json.dumps(content)

        print("Content : ", jsonContent)
        print("Write to : ", path.path)

        file.writeContent(jsonContent)
    def readWrite(self):
        f = File("test_read_write.txt")
        content = "Hello\nI am a file"
        f.writeContent(content)
        readContent = f.readContent()
        assert(content == readContent)
        f.removeFile()

        f = File("test_read_write2.txt")
        content = "Hello\nI am a file"
        f.writeContent(content)

        content = "This is another content for the file"
        f.writeContent(content)
        readContent = f.readContent()
        assert(content == readContent)
        f.removeFile()
Exemple #4
0
 def writeContent(self, folderPath):
     f = File(folderPath + "/" + self.getFileName())
     f.writeContent(self.getDocumentContent())
Exemple #5
0
 def writeContent(self, folderPath):
     notesPath = MyPath(folderPath + "/" + self.getFileName())
     notesPath = notesPath.findNotUsedPath()
     f = File(notesPath)
     f.writeContent(self.getDocumentContent())