changeset 87b2d96abf71 in trytond:5.2
details: https://hg.tryton.org/trytond?cmd=changeset;node=87b2d96abf71
description:
Adapt file mode depending on data type in soffice conversion
issue8848
review278211002
(grafted from 8afd9b41c1e8c602993cef460132ee8cdbc227cd)
diffstat:
trytond/report/report.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diffs (13 lines):
diff -r b5a074690c40 -r 87b2d96abf71 trytond/report/report.py
--- a/trytond/report/report.py Mon Dec 02 20:37:21 2019 +0100
+++ b/trytond/report/report.py Fri Nov 29 15:16:11 2019 +0100
@@ -306,7 +306,8 @@
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',