changeset 8afd9b41c1e8 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=8afd9b41c1e8
description:
Adapt file mode depending on data type in soffice conversion
issue8848
review278211002
diffstat:
trytond/report/report.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diffs (13 lines):
diff -r 814183c07ae1 -r 8afd9b41c1e8 trytond/report/report.py
--- a/trytond/report/report.py Wed Nov 27 17:48:32 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',