6291: No Text report, with output format ODF, is created

svn: r21077
This commit is contained in:
Benny Malengier 2013-01-11 22:32:41 +00:00
parent 0cffe803a5
commit bb491fa5ef

View File

@ -1017,7 +1017,10 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
return
not_extension, extension = os.path.splitext(file_name)
odf_name = md5(file_name).hexdigest() + extension
file_name_hash = file_name
if sys.version_info[0] >= 3:
file_name_hash = file_name_hash.encode('utf-8')
odf_name = md5(file_name_hash).hexdigest() + extension
media_list_item = (file_name, odf_name)
if not media_list_item in self.media_list:
@ -1180,7 +1183,9 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
"""
Add a zip file to an archive
"""
zipinfo = zipfile.ZipInfo(name.encode('utf-8'))
if sys.version_info[0] < 3:
name = name.encode('utf-8')
zipinfo = zipfile.ZipInfo(name)
zipinfo.date_time = t
zipinfo.compress_type = zipfile.ZIP_DEFLATED
zipinfo.external_attr = 0o644 << 16