Fix bug storing mimefiles.
This commit is contained in:
parent
954fe6aa9b
commit
f74046fb09
2 changed files with 8 additions and 7 deletions
11
secretary.py
11
secretary.py
|
|
@ -180,14 +180,15 @@ class Renderer(object):
|
|||
mimetype = files['mimetype']
|
||||
del files['mimetype']
|
||||
|
||||
zipdoc = zipfile.ZipFile(zip_file, 'a')
|
||||
zipdoc = zipfile.ZipFile(zip_file, 'a', zipfile.ZIP_DEFLATED)
|
||||
|
||||
zipdoc.writestr('mimetype', mimetype, zipfile.ZIP_STORED)
|
||||
# Store mimetype without without compression using a ZipInfo object
|
||||
# for compatibility with Py2.6 which doesn't have compress_type
|
||||
# parameter in ZipFile.writestr function
|
||||
mime_zipinfo = zipfile.ZipInfo('mimetype')
|
||||
zipdoc.writestr(mime_zipinfo, mimetype)
|
||||
|
||||
for fname, content in files.items():
|
||||
if sys.version_info >= (2, 7):
|
||||
zipdoc.writestr(fname, content, zipfile.ZIP_DEFLATED)
|
||||
else:
|
||||
zipdoc.writestr(fname, content)
|
||||
|
||||
self.log.debug('Document packing completed')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue