'Write the document to an open file pointer
This is where the real work is done'

def __zipwrite(self, outputfp):

    self._z = outputfp
    self._now = time.localtime()[:6]
    self.manifest = manifest.Manifest()
    zi = zipfile.ZipInfo('mimetype', self._now)
    zi.compress_type = zipfile.ZIP_STORED
    zi.external_attr = UNIXPERMS
    self._z.writestr(zi, self.mimetype)
    self._saveXmlObjects(self, '')
    self._savePictures(self, '')
    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
        zi.external_attr = UNIXPERMS
        self._z.writestr(zi, self.thumbnail)
    for op in self._extra:
        if (op.filename == 'META-INF/documentsignatures.xml'):
            continue
        self.manifest.addElement(manifest.FileEntry(fullpath=op.filename, mediatype=op.mediatype))
        zi = zipfile.ZipInfo(op.filename.encode('utf-8'), self._now)
        zi.compress_type = zipfile.ZIP_DEFLATED
        zi.external_attr = UNIXPERMS
        if (op.content is not None):
            self._z.writestr(zi, op.content)
    zi = zipfile.ZipInfo('META-INF/manifest.xml', self._now)
    zi.compress_type = zipfile.ZIP_DEFLATED
    zi.external_attr = UNIXPERMS
    self._z.writestr(zi, self.__manifestxml())
    del self._z
    del self._now
    del self.manifest
