changeset 57534f543882 in trytond:5.4
details: https://hg.tryton.org/trytond?cmd=changeset;node=57534f543882
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 fe79ac7a12ec -r 57534f543882 trytond/report/report.py
--- a/trytond/report/report.py Fri Nov 08 19:14:52 2019 +0100
+++ b/trytond/report/report.py Fri Nov 29 15:16:11 2019 +0100
@@ -320,7 +320,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',