Fix bug storing mimefiles.
This commit is contained in:
parent
954fe6aa9b
commit
f74046fb09
2 changed files with 8 additions and 7 deletions
13
secretary.py
13
secretary.py
|
|
@ -180,15 +180,16 @@ class Renderer(object):
|
||||||
mimetype = files['mimetype']
|
mimetype = files['mimetype']
|
||||||
del 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():
|
for fname, content in files.items():
|
||||||
if sys.version_info >= (2, 7):
|
zipdoc.writestr(fname, content)
|
||||||
zipdoc.writestr(fname, content, zipfile.ZIP_DEFLATED)
|
|
||||||
else:
|
|
||||||
zipdoc.writestr(fname, content)
|
|
||||||
|
|
||||||
self.log.debug('Document packing completed')
|
self.log.debug('Document packing completed')
|
||||||
|
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -3,4 +3,4 @@ envlist = py26, py27, py3, py33, py34, py35, py36
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps = pytest
|
deps = pytest
|
||||||
commands= py.test
|
commands = py.test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue