Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
915a2451
Commit
915a2451
authored
Oct 07, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: PERF improve for loops
parent
08d28458
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
87 deletions
+85
-87
product/ERP5Workflow/Document/InteractionWorkflow.py
product/ERP5Workflow/Document/InteractionWorkflow.py
+12
-7
product/ERP5Workflow/Document/State.py
product/ERP5Workflow/Document/State.py
+2
-4
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+55
-63
product/ERP5Workflow/Document/Worklist.py
product/ERP5Workflow/Document/Worklist.py
+16
-13
No files found.
product/ERP5Workflow/Document/InteractionWorkflow.py
View file @
915a2451
...
...
@@ -95,9 +95,12 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
chained_ptype_list
=
[]
wf_tool
=
getToolByName
(
self
,
'portal_workflow'
)
types_tool
=
getToolByName
(
self
,
'portal_types'
)
for
ptype
in
types_tool
.
objectValues
():
if
self
.
getId
()
in
ptype
.
getTypeWorkflowList
():
chained_ptype_list
.
append
(
ptype
.
getId
())
interaction_workflow_id
=
self
.
getId
()
append
=
chained_ptype_list
.
append
for
portal_type
in
types_tool
.
objectValues
():
if
interaction_workflow_id
in
portal_type
.
getTypeWorkflowList
():
append
(
portal_type
.
getId
())
return
chained_ptype_list
security
.
declarePrivate
(
'listObjectActions'
)
...
...
@@ -208,8 +211,9 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
security
.
declarePrivate
(
'getTransitionIdList'
)
def
getTransitionIdList
(
self
):
id_list
=
[]
append
=
id_list
.
append
for
ob
in
self
.
objectValues
(
portal_type
=
"Interaction"
):
id_list
.
append
(
ob
.
getReference
())
append
(
ob
.
getReference
())
return
id_list
security
.
declarePrivate
(
'notifyWorkflowMethod'
)
...
...
@@ -229,11 +233,11 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
kw
=
kw
.
copy
()
kw
[
'workflow_method_args'
]
=
args
filtered_transition_list
=
[]
append
=
filtered_transition_list
.
append
for
t_id
in
transition_list
:
tdef
=
self
.
_getOb
(
'interaction_'
+
t_id
)
assert
tdef
.
getTriggerType
()
==
TRIGGER_WORKFLOW_METHOD
filtered_transition_list
.
append
(
tdef
.
getId
())
append
(
tdef
.
getId
())
former_status
=
{}
sci
=
StateChangeInfo
(
...
...
@@ -259,6 +263,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
kw
[
'workflow_method_args'
]
=
args
kw
[
'workflow_method_result'
]
=
result
workflow_variable_list
=
self
.
objectValues
(
portal_type
=
'Workflow Variable'
)
for
t_id
in
transition_list
:
tdef
=
self
.
_getOb
(
'interaction_'
+
t_id
)
assert
tdef
.
getTriggerType
()
==
TRIGGER_WORKFLOW_METHOD
...
...
@@ -271,7 +276,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
if
tdef_exprs
is
None
:
tdef_exprs
=
{}
status
=
{}
for
vdef
in
self
.
objectValues
(
portal_type
=
'Workflow Variable'
)
:
for
vdef
in
workflow_variable_list
:
id
=
vdef
.
getId
()
if
not
vdef
.
getStatusIncluded
():
continue
...
...
product/ERP5Workflow/Document/State.py
View file @
915a2451
...
...
@@ -124,10 +124,8 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDestinationReferenceList'
)
def
getDestinationReferenceList
(
self
):
ref_list
=
[]
for
tr
in
self
.
getDestinationValueList
():
ref_list
.
append
(
tr
.
getReference
())
return
ref_list
return
[
transition
.
getReference
()
for
transition
in
self
.
getDestinationValueList
()]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailableTypeList'
)
...
...
product/ERP5Workflow/Document/Workflow.py
View file @
915a2451
This diff is collapsed.
Click to expand it.
product/ERP5Workflow/Document/Worklist.py
View file @
915a2451
...
...
@@ -75,13 +75,12 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject,
)
def getAvailableCatalogVars(self):
res = []
res.append(self.getParentValue().getStateVariable())
for vdef in self.getParentValue().contentValues(portal_type="Workflow Variable"):
if vdef.getForCatalog():
res.append(vdef.getId())
for vdef in self.objectValues():
res.append(vdef.getId())
parent = self.getParentValue()
res = [parent.getStateVariable()]
res += [variable.getId() for variable in self.objectValues()]
res += [variable for variable in
parent.contentValues(portal_type="Workflow Variable")
if variable.getForCatalog()]
res.sort()
return res
...
...
@@ -89,7 +88,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject,
# Keep worklist variables updating, correspond to workflow variables.
# In the new workflow, we may not need this function for the moment.
res = []
# XXX(WORKFLOW): is there a reason not to return self.objectValues() here?
for worklist_variable_value in self.objectValues():
res.append(worklist_variable_value)
return res
...
...
@@ -107,16 +106,20 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject,
variable_id = variable_value.getId()
workflow_variable_id_list.append(variable_id)
worklist_variable_value = self._getOb(variable_id, None)
if worklist_variable_value is None and variable_value.getForCatalog() == 1 and variable_id not in default_variable_id_list:
if (worklist_variable_value is None
and variable_value.getForCatalog() == 1
and variable_id not in default_variable_id_list):
variable_value_ref = variable_value.getReference()
worklist_variable_value = self.newContent(portal_type='
Worklist
Variable
')
worklist_variable_value.setReference(variable_value_ref)
worklist_variable_value.setVariableExpression(variable_value.getVariableExpression())
worklist_variable_value.setVariableValue(variable_value.getVariableValue())
res.append(worklist_variable_value)
if worklist_variable_value and worklist_variable_value not in res and variable_value.getForCatalog() == 1:
if (worklist_variable_value and worklist_variable_value not in res
and variable_value.getForCatalog() == 1):
res.append(worklist_variable_value)
if worklist_variable_value in res and variable_value.getForCatalog() == 0:
if (worklist_variable_value in res
and variable_value.getForCatalog() == 0):
self._delObject(variable_id)
res.remove(worklist_variable_value)
...
...
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