Use os separator in filename when calling file_open

This commit is contained in:
Cédric Krier committed 2009-02-19 13:54:23 +01:00
1 parent 9bd91ec4e6
commit 0a82985b48
1 file changed
+5 -2
+5 -2
View File
@@ -5,6 +5,7 @@ from trytond.osv import fields, OSV
from trytond.tools import file_open
from trytond.backend import TableHandler
import base64
import os
class Action(OSV):
@@ -269,7 +270,8 @@ class ActionReport(OSV):
data = report[name + '_data']
if not data and report[name[:-8]]:
try:
data = base64.encodestring(file_open(report[name[:-8]],
data = base64.encodestring(file_open(
report[name[:-8]].replace('/', os.sep),
mode='rb').read())
except:
data = False
@@ -284,7 +286,8 @@ class ActionReport(OSV):
res = {}
for report in self.browse(cursor, user, ids, context=context):
try:
data = base64.encodestring(file_open(report.style,
data = base64.encodestring(file_open(
report.style.replace('/', os.sep),
mode='rb').read())
except:
data = False