Logo Search packages:      
Sourcecode: ocrfeeder version File versions  Download package

def odf::opendocument::OpenDocument::save (   self,
  outputfile,
  addsuffix = False 
)

Save the document under the filename 

Definition at line 222 of file opendocument.py.

00222                                                :
        """ Save the document under the filename """
        self.manifest = manifest.Manifest()
        mimetype = self.mimetype
        suffix = odmimetypes.get(mimetype,'.xxx')

        if outputfile == '-':
            self._z = zipfile.ZipFile(sys.stdout,"w")
        else:
            if addsuffix:
                outputfile = outputfile + suffix
            self._z = zipfile.ZipFile(outputfile,"w")

        self._now = time.localtime()[:6]

        # Write mimetype
        zi = zipfile.ZipInfo('mimetype', self._now)
        zi.compress_type = zipfile.ZIP_STORED
        self._z.writestr(zi, self.mimetype)

        self._saveXmlObjects(self,"")

        # Write pictures
        self._savePictures(self,"")

        # Write the thumbnail
        if self.thumbnail is not None:
            self.manifest.addElement(manifest.FileEntry(fullpath="Thumbnails/", mediatype=''))
            self.manifest.addElement(manifest.FileEntry(fullpath="Thumbnails/thumbnail.png", mediatype=''))
            zi = zipfile.ZipInfo("Thumbnails/thumbnail.png", self._now)
            zi.compress_type = zipfile.ZIP_DEFLATED
            self._z.writestr(zi, self.thumbnail)

        # Write manifest
        zi = zipfile.ZipInfo("META-INF/manifest.xml", self._now)
        zi.compress_type = zipfile.ZIP_DEFLATED
        self._z.writestr(zi, self.manifestxml() )
        self._z.close()
        del self._z
        del self._now
        del self.manifest


    def _saveXmlObjects(self, object, folder):


Generated by  Doxygen 1.6.0   Back to index