Skip to content

Commit 988891c

Browse files
committed
Don't try to stringify binary files like images.
1 parent e103b5c commit 988891c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

templated_docs/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ def fill_template(template_name, context, output_format='odt'):
9696

9797
manifest_data = ''
9898
for name in source.namelist():
99-
data = smart_str(source.read(name))
99+
data = source.read(name)
100+
if name.endswith('.xml'):
101+
data = smart_str(data)
102+
100103
if any(name.endswith(file) for file in ('content.xml', 'styles.xml')):
101104
template = Template(fix_inline_tags(data))
102105
data = template.render(context)

0 commit comments

Comments
 (0)