Adapt file mode depending on data type in soffice conversion

issue8848
review278211002
This commit is contained in:
Sergi Almacellas Abellana committed 2019-11-29 15:16:11 +01:00
1 parent dfd71fae7c
commit 2709bf2fa9
1 file changed
+2 -1
+2 -1
View File
@@ -320,7 +320,8 @@ class Report(URLMixin, PoolBase):
path = os.path.join(
dtemp, report.report_name + os.extsep + input_format)
oext = FORMAT2EXT.get(output_format, output_format)
with open(path, 'wb+') as fp:
mode = 'w+' if isinstance(data, str) else 'wb+'
with open(path, mode) as fp:
fp.write(data)
try:
cmd = ['soffice',