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
|
||||
(No workflow available) show
|
||||
showpage'''
|
||||
args = ('ps2pdf', '-sPAPERSIZE=a4', '-', '-')
|
||||
input, output = tools.exec_pg_command_pipe(*args)
|
||||
if os.name == "nt":
|
||||
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.close()
|
||||
self.result = output.read()
|
||||
|
|
|
@ -431,7 +431,8 @@ class report_spool(netsvc.Service):
|
|||
res2 = result['result'].encode('latin1', 'replace')
|
||||
else:
|
||||
res2 = result['result']
|
||||
res['result'] = base64.encodestring(res2)
|
||||
if res2:
|
||||
res['result'] = base64.encodestring(res2)
|
||||
res['format'] = result['format']
|
||||
del self._reports[report_id]
|
||||
return res
|
||||
|
|
|
@ -104,7 +104,11 @@ def init_db(cr):
|
|||
cr.commit()
|
||||
|
||||
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)]
|
||||
for dir in path:
|
||||
if name in os.listdir(dir):
|
||||
|
@ -121,7 +125,6 @@ def exec_pg_command(name, *args):
|
|||
prog = find_pg_tool(name)
|
||||
args2 = (os.path.basename(prog),) + args
|
||||
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):
|
||||
prog = find_pg_tool(name)
|
||||
|
@ -131,6 +134,16 @@ def exec_pg_command_pipe(name, *args):
|
|||
cmd = prog + ' ' + ' '.join(args)
|
||||
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
|
||||
#----------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue