Update manifest with files added from style for issue1507
This commit is contained in:
1 parent
f7aebd99be
commit
d351113a3b
1 file changed
+12
@@ -21,6 +21,10 @@ import warnings
|
||||
warnings.simplefilter("ignore")
|
||||
import relatorio.reporting
|
||||
warnings.resetwarnings()
|
||||
try:
|
||||
from relatorio.templates.opendocument import Manifest, MANIFEST
|
||||
except ImportError:
|
||||
Manifest = None
|
||||
|
||||
import tempfile
|
||||
from genshi.filters import Translator
|
||||
@@ -161,11 +165,15 @@ class Report(object):
|
||||
|
||||
style_info = None
|
||||
style_xml = None
|
||||
manifest = None
|
||||
for f in content_z.infolist():
|
||||
if f.filename == 'styles.xml' and report.style_content:
|
||||
style_info = f
|
||||
style_xml = content_z.read(f.filename)
|
||||
continue
|
||||
elif Manifest and f.filename == MANIFEST:
|
||||
manifest = Manifest(content_z.read(f.filename))
|
||||
continue
|
||||
outzip.writestr(f, content_z.read(f.filename))
|
||||
|
||||
if report.style_content:
|
||||
@@ -183,6 +191,7 @@ class Report(object):
|
||||
if file.startswith('Pictures'):
|
||||
picture = style2_z.read(file)
|
||||
pictures.append((file, picture))
|
||||
manifest.add_file_entry(file)
|
||||
style2_z.close()
|
||||
style2_io.close()
|
||||
dom_style2 = xml.dom.minidom.parseString(style2_xml)
|
||||
@@ -203,6 +212,9 @@ class Report(object):
|
||||
for file, picture in pictures:
|
||||
outzip.writestr(file, picture)
|
||||
|
||||
if manifest:
|
||||
outzip.writestr(MANIFEST, str(manifest))
|
||||
|
||||
content_z.close()
|
||||
content_io.close()
|
||||
outzip.close()
|
||||
|
||||
Reference in new issue
Block a user