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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
erp5
Commits
8b09bfe0
Commit
8b09bfe0
authored
Mar 30, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Base.py: add ERP5 interaction workflow compatibility.
parent
4bf202cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
2 deletions
+77
-2
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+77
-2
No files found.
product/ERP5Type/Base.py
View file @
8b09bfe0
...
...
@@ -686,7 +686,8 @@ def intializePortalTypeERP5WorkflowMethod(ptype_klass, portal_ERP5Workflow):
storage
=
interaction_workflow_dict
else
:
continue
### zwj: compatibility for Interaction Workflow and Workflow
### zwj: compatibility for Interaction Workflow and Workflow ===================
transition_id_set
=
set
(
x
.
getId
()
for
x
in
transition_list
)
trigger_dict
=
{}
for
tr_id
in
transition_id_set
:
...
...
@@ -735,8 +736,82 @@ def intializePortalTypeERP5WorkflowMethod(ptype_klass, portal_ERP5Workflow):
method
.
registerTransitionAlways
(
portal_type
,
ERP5Workflow_id
,
tr_id
)
### zwj: should also generate interaction workflow methods
if
not
interaction_workflow_dict
:
return
class_method_id_list
=
ptype_klass
.
getClassMethodIdList
(
ptype_klass
)
interaction_queue
=
[]
for
wf_id
,
v
in
interaction_workflow_dict
.
iteritems
():
transition_id_set
,
trigger_dict
=
v
for
tr_id
,
tdef
in
trigger_dict
.
iteritems
():
# check portal type filter
if
(
tdef
.
portal_type_filter
is
not
None
and
portal_type
not
in
tdef
.
portal_type_filter
):
continue
#check portal type group filter
if
tdef
.
portal_type_group_filter
is
not
None
:
getPortalGroupedTypeSet
=
portal_workflow
.
getPortalObject
().
_getPortalGroupedTypeSet
if
not
any
(
portal_type
in
getPortalGroupedTypeSet
(
portal_type_group
)
for
portal_type_group
in
tdef
.
portal_type_group_filter
):
continue
for
imethod_id
in
tdef
.
method_id
:
if
wildcard_interaction_method_id_match
(
imethod_id
):
method_id_mathcer
=
re
.
compile
(
imethod_id
).
match
# queue transitions using regexps for later examination
interaction_queue
.
append
((
wf_id
,
tr_id
,
transition_id_set
,
tdef
.
once_per_transaction
,
method_id_matcher
))
method_id_list
=
filter
(
method_id_matcher
,
class_method_id_list
)
else
:
method_id_list
=
[
imethod_id
]
for
method_id
in
method_id_list
:
method
=
getattr
(
ptype_klass
,
method_id
,
_MARKER
)
if
method
is
_MARKER
:
if
method_id
not
in
ptype_klass
.
security
.
names
:
ptype_klass
.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
method_id
)
ptype_klass
.
registerERP5WorkflowMethod
(
method_id
,
wf_id
,
tr_id
,
tdef
.
once_per_transaction
)
continue
# wrap method
if
not
callable
(
method
):
LOG
(
'initializePortalTypeDynamicWorkflowMethods'
,
100
,
'WARNING! Can not initialize %s on %s'
%
\
(
method_id
,
portal_type
))
continue
if
not
isinstance
(
method
,
WorkflowMethod
):
method
=
WorkflowMethod
(
method
)
setattr
(
ptype_klass
,
method_id
,
method
)
else
:
transition_id
=
method
.
getTransitionId
()
if
transition_id
in
transition_id_set
:
method
.
registerTransitionAlways
(
portal_type
,
wf_id
,
transition_id
)
if
tdef
.
once_per_transaction
:
method
.
registerTransitionOncePerTransaction
(
portal_type
,
wf_id
,
tr_id
)
else
:
method
.
registerTransitionAlways
(
portal_type
,
wf_id
,
tr_id
)
### ==========================================================================
if
not
interaction_queue
:
return
new_method_set
=
set
(
ptype_klass
.
getWorkflowMethodIdList
())
added_method_set
=
new_method_set
.
difference
(
class_method_id_list
)
for
wf_id
,
tr_id
,
transition_id_set
,
once
,
method_id_matcher
in
interaction_queue
:
for
method_id
in
filter
(
method_id_matcher
,
added_method_set
):
# method must already exist and be a workflow method
method
=
getattr
(
ptype_klass
,
method_id
)
transition_id
=
method
.
getTransitionId
()
if
transition_id
in
transition_id_set
:
method
.
registerTransitionAlways
(
portal_type
,
wf_id
,
transition_id
)
if
once
:
method
.
registerTransitionOncePerTransaction
(
portal_type
,
wf_id
,
tr_id
)
else
:
method
.
registerTransitionAlways
(
portal_type
,
wf_id
,
tr_id
)
### =================================== compatibility for interaction workflow
def
initializePortalTypeDynamicWorkflowMethods
(
ptype_klass
,
portal_workflow
):
...
...
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