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
iv
erp5
Commits
6ea012aa
Commit
6ea012aa
authored
Aug 17, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: raise if script_id is not correct
parent
195aab30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+21
-21
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
6ea012aa
...
@@ -586,6 +586,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -586,6 +586,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if
tdef
is
None
:
if
tdef
is
None
:
new_sdef
=
self
.
getSourceValue
()
new_sdef
=
self
.
getSourceValue
()
new_state
=
new_sdef
.
getReference
()
new_state
=
new_sdef
.
getReference
()
if
not
new_sdef
:
if
not
new_sdef
:
# Do nothing if there is no initial state. We may want to create
# Do nothing if there is no initial state. We may want to create
# workflows with no state at all, only for worklists.
# workflows with no state at all, only for worklists.
...
@@ -607,20 +608,19 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -607,20 +608,19 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
sci
=
StateChangeInfo
(
sci
=
StateChangeInfo
(
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
for
script_id
in
script_id_list
:
for
script_id
in
script_id_list
:
script
=
self
.
_getOb
(
script_id
,
None
)
script
=
self
.
_getOb
(
script_id
)
if
script
:
# Pass lots of info to the script in a single parameter.
# Pass lots of info to the script in a single parameter.
if
script
.
getPortalType
()
!=
'Workflow Script'
:
if
script
.
getPortalType
()
!=
'Workflow Script'
:
raise
NotImplementedError
(
'Unsupported Script %s for state %s'
%
(
script_id
,
old_sdef
.
getReference
()))
raise
NotImplementedError
(
'Unsupported Script %s for state %s'
%
(
script_id
,
old_sdef
.
getReference
()))
try
:
try
:
script
(
sci
)
# May throw an exception.
script
(
sci
)
# May throw an exception.
except
ValidationFailed
,
validation_exc
:
except
ValidationFailed
,
validation_exc
:
before_script_success
=
0
before_script_success
=
0
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
validation_exc_traceback
=
sys
.
exc_traceback
validation_exc_traceback
=
sys
.
exc_traceback
except
ObjectMoved
,
moved_exc
:
except
ObjectMoved
,
moved_exc
:
ob
=
moved_exc
.
getNewObject
()
ob
=
moved_exc
.
getNewObject
()
# Re-raise after transition
# Re-raise after transition
# update variables
# update variables
state_values
=
None
state_values
=
None
...
@@ -696,14 +696,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -696,14 +696,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self
.
updateRoleMappingsFor
(
document
)
self
.
updateRoleMappingsFor
(
document
)
# Execute the "after" script.
# Execute the "after" script.
if
tdef
is
not
None
and
tdef
.
getAfterScriptIdList
()
:
if
tdef
is
not
None
:
script_id_list
=
tdef
.
getAfterScriptIdList
()
script_id_list
=
tdef
.
getAfterScriptIdList
()
kwargs
=
form_kw
if
script_id_list
:
sci
=
StateChangeInfo
(
kwargs
=
form_kw
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
sci
=
StateChangeInfo
(
for
script_id
in
script_id_list
:
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
script
=
self
.
_getOb
(
script_id
,
None
)
for
script_id
in
script_id_list
:
if
script
:
script
=
self
.
_getOb
(
script_id
)
# Script can be either script or workflow method
# Script can be either script or workflow method
if
script_id
in
old_sdef
.
getDestinationIdList
()
and
\
if
script_id
in
old_sdef
.
getDestinationIdList
()
and
\
self
.
_getOb
(
script_id
).
getTriggerType
()
==
TRIGGER_WORKFLOW_METHOD
:
self
.
_getOb
(
script_id
).
getTriggerType
()
==
TRIGGER_WORKFLOW_METHOD
:
...
...
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