Check python version to set zip compresion
This commit is contained in:
parent
bdec463350
commit
bb46009e01
1 changed files with 5 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ import os
|
||||||
import zipfile
|
import zipfile
|
||||||
import StringIO
|
import StringIO
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from jinja2 import Template as TemplateEngine
|
from jinja2 import Template as TemplateEngine
|
||||||
|
|
@ -196,7 +196,10 @@ def render_template(template, **template_args):
|
||||||
# mimetype is stored within the ODF
|
# mimetype is stored within the ODF
|
||||||
mimetype = out
|
mimetype = out
|
||||||
|
|
||||||
output.writestr(zi.filename, out, zipfile.ZIP_DEFLATED)
|
if sys.version_info >= (2, 7):
|
||||||
|
output.writestr(zi.filename, out, zipfile.ZIP_DEFLATED)
|
||||||
|
else:
|
||||||
|
output.writestr(zi.filename, out)
|
||||||
|
|
||||||
# close and finish
|
# close and finish
|
||||||
input.close()
|
input.close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue