KERNEL: fix print workflow on win32
bzr revid: ced-281965613dcbae881fe25f41fcd5dc0f783e7fa7
This commit is contained in:
parent
414e265dcc
commit
80f0a50e03
|
@ -143,8 +143,15 @@ class report_graph_instance(object):
|
||||||
1.5 inch 15 inch moveto
|
1.5 inch 15 inch moveto
|
||||||
(No workflow available) show
|
(No workflow available) show
|
||||||
showpage'''
|
showpage'''
|
||||||
args = ('ps2pdf', '-sPAPERSIZE=a4', '-', '-')
|
if os.name == "nt":
|
||||||
input, output = tools.exec_pg_command_pipe(*args)
|
prog = "ps2pdf.bat"
|
||||||
|
else:
|
||||||
|
prog = "ps2pdffoo"
|
||||||
|
args = (prog, '-sPAPERSIZE=a4', '-', '-')
|
||||||
|
try:
|
||||||
|
input, output = tools.exec_command_pipe(*args)
|
||||||
|
except:
|
||||||
|
return
|
||||||
input.write(ps_string)
|
input.write(ps_string)
|
||||||
input.close()
|
input.close()
|
||||||
self.result = output.read()
|
self.result = output.read()
|
||||||
|
|
|
@ -431,6 +431,7 @@ class report_spool(netsvc.Service):
|
||||||
res2 = result['result'].encode('latin1', 'replace')
|
res2 = result['result'].encode('latin1', 'replace')
|
||||||
else:
|
else:
|
||||||
res2 = result['result']
|
res2 = result['result']
|
||||||
|
if res2:
|
||||||
res['result'] = base64.encodestring(res2)
|
res['result'] = base64.encodestring(res2)
|
||||||
res['format'] = result['format']
|
res['format'] = result['format']
|
||||||
del self._reports[report_id]
|
del self._reports[report_id]
|
||||||
|
|
|
@ -104,7 +104,11 @@ def init_db(cr):
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
|
||||||
def find_in_path(name):
|
def find_in_path(name):
|
||||||
path = [dir for dir in os.environ['PATH'].split(':')
|
if os.name == "nt":
|
||||||
|
sep = ';'
|
||||||
|
else:
|
||||||
|
sep = ':'
|
||||||
|
path = [dir for dir in os.environ['PATH'].split(sep)
|
||||||
if os.path.isdir(dir)]
|
if os.path.isdir(dir)]
|
||||||
for dir in path:
|
for dir in path:
|
||||||
if name in os.listdir(dir):
|
if name in os.listdir(dir):
|
||||||
|
@ -121,7 +125,6 @@ def exec_pg_command(name, *args):
|
||||||
prog = find_pg_tool(name)
|
prog = find_pg_tool(name)
|
||||||
args2 = (os.path.basename(prog),) + args
|
args2 = (os.path.basename(prog),) + args
|
||||||
return os.spawnv(os.P_WAIT, prog, args2)
|
return os.spawnv(os.P_WAIT, prog, args2)
|
||||||
# os.spawnv(os.P_WAIT, prog, ([os.path.basename(prog)] + args))
|
|
||||||
|
|
||||||
def exec_pg_command_pipe(name, *args):
|
def exec_pg_command_pipe(name, *args):
|
||||||
prog = find_pg_tool(name)
|
prog = find_pg_tool(name)
|
||||||
|
@ -131,6 +134,16 @@ def exec_pg_command_pipe(name, *args):
|
||||||
cmd = prog + ' ' + ' '.join(args)
|
cmd = prog + ' ' + ' '.join(args)
|
||||||
return os.popen2(cmd, 'b')
|
return os.popen2(cmd, 'b')
|
||||||
|
|
||||||
|
def exec_command_pipe(name, *args):
|
||||||
|
prog = find_in_path(name)
|
||||||
|
if not prog:
|
||||||
|
raise
|
||||||
|
if os.name == "nt":
|
||||||
|
cmd = '"'+prog+'" '+' '.join(args)
|
||||||
|
else:
|
||||||
|
cmd = prog+' '+' '.join(args)
|
||||||
|
return os.popen2(cmd, 'b')
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# File paths
|
# File paths
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue