Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
90c6165c
Commit
90c6165c
authored
Jun 28, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use temporary files at all to render DWWorkflow graphes
parent
5abd0ffc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
32 deletions
+19
-32
product/ERP5Type/patches/DCWorkflowGraph.py
product/ERP5Type/patches/DCWorkflowGraph.py
+19
-32
No files found.
product/ERP5Type/patches/DCWorkflowGraph.py
View file @
90c6165c
...
@@ -75,7 +75,6 @@ from Products.DCWorkflowGraph import DCWorkflowGraph
...
@@ -75,7 +75,6 @@ from Products.DCWorkflowGraph import DCWorkflowGraph
DCWorkflowGraph
.
getObjectTitle
=
getObjectTitle
DCWorkflowGraph
.
getObjectTitle
=
getObjectTitle
from
Products.DCWorkflowGraph.config
import
bin_search_path
,
DOT_EXE
from
Products.DCWorkflowGraph.config
import
bin_search_path
,
DOT_EXE
from
tempfile
import
NamedTemporaryFile
from
zLOG
import
LOG
,
WARNING
from
zLOG
import
LOG
,
WARNING
import
subprocess
import
subprocess
...
@@ -102,37 +101,25 @@ def getGraph(self, wf_id="", format="png", REQUEST=None):
...
@@ -102,37 +101,25 @@ def getGraph(self, wf_id="", format="png", REQUEST=None):
except
AttributeError
:
except
AttributeError
:
# no portal_properties or site_properties, fallback to:
# no portal_properties or site_properties, fallback to:
encoding
=
self
.
management_page_charset
.
lower
()
encoding
=
self
.
management_page_charset
.
lower
()
pot
=
pot
.
encode
(
encoding
)
result
=
pot
.
encode
(
encoding
)
result
=
None
with
NamedTemporaryFile
(
suffix
=
'.dot'
)
as
infile
:
if
REQUEST
is
None
:
infile
.
write
(
pot
)
REQUEST
=
self
.
REQUEST
infile
.
seek
(
0
)
setHeader
=
REQUEST
.
RESPONSE
.
setHeader
if
REQUEST
is
None
:
if
format
!=
'dot'
:
REQUEST
=
self
.
REQUEST
p
=
subprocess
.
Popen
((
DCWorkflowGraph
.
bin_search
(
DOT_EXE
),
response
=
REQUEST
.
RESPONSE
'-Nfontname=IPAexGothic'
,
'-Nfontsize=10'
,
'-Efontname=IPAexGothic'
,
'-Efontsize=10'
,
if
format
!=
'dot'
:
'-T%s'
%
format
),
with
NamedTemporaryFile
(
suffix
=
'.%s'
%
format
)
as
outfile
:
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
subprocess
.
call
((
DCWorkflowGraph
.
bin_search
(
DOT_EXE
),
result
=
p
.
communicate
(
pot
)[
0
]
'-Nfontname="IPAexGothic"'
,
'-Nfontsize=10'
,
setHeader
(
'Content-Type'
,
'image/%s'
%
format
)
'-Efontname="IPAexGothic"'
,
else
:
'-Efontsize=10'
,
filename
=
wf_id
or
self
.
getId
()
'-T%s'
%
format
,
setHeader
(
'Content-Type'
,
'text/x-graphviz'
)
'-o'
,
setHeader
(
'Content-Disposition'
,
'attachment; filename=%s.dot'
%
filename
)
outfile
.
name
,
infile
.
name
))
result
=
outfile
.
read
()
response
.
setHeader
(
'Content-Type'
,
'image/%s'
%
format
)
else
:
result
=
infile
.
read
()
filename
=
wf_id
or
self
.
getId
()
response
.
setHeader
(
'Content-Type'
,
'text/x-graphviz'
)
response
.
setHeader
(
'Content-Disposition'
,
'attachment; filename=%s.dot'
%
filename
)
if
not
result
:
if
not
result
:
LOG
(
"ERP5Type.patches.DCWorkflowGraph"
,
WARNING
,
LOG
(
"ERP5Type.patches.DCWorkflowGraph"
,
WARNING
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment