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
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):
if
tdef
is
None
:
new_sdef
=
self
.
getSourceValue
()
new_state
=
new_sdef
.
getReference
()
if
not
new_sdef
:
# Do nothing if there is no initial state. We may want to create
# workflows with no state at all, only for worklists.
...
...
@@ -607,20 +608,19 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
sci
=
StateChangeInfo
(
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
for
script_id
in
script_id_list
:
script
=
self
.
_getOb
(
script_id
,
None
)
if
script
:
# Pass lots of info to the script in a single parameter.
if
script
.
getPortalType
()
!=
'Workflow Script'
:
raise
NotImplementedError
(
'Unsupported Script %s for state %s'
%
(
script_id
,
old_sdef
.
getReference
()))
try
:
script
(
sci
)
# May throw an exception.
except
ValidationFailed
,
validation_exc
:
before_script_success
=
0
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
validation_exc_traceback
=
sys
.
exc_traceback
except
ObjectMoved
,
moved_exc
:
ob
=
moved_exc
.
getNewObject
()
# Re-raise after transition
script
=
self
.
_getOb
(
script_id
)
# Pass lots of info to the script in a single parameter.
if
script
.
getPortalType
()
!=
'Workflow Script'
:
raise
NotImplementedError
(
'Unsupported Script %s for state %s'
%
(
script_id
,
old_sdef
.
getReference
()))
try
:
script
(
sci
)
# May throw an exception.
except
ValidationFailed
,
validation_exc
:
before_script_success
=
0
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
validation_exc_traceback
=
sys
.
exc_traceback
except
ObjectMoved
,
moved_exc
:
ob
=
moved_exc
.
getNewObject
()
# Re-raise after transition
# update variables
state_values
=
None
...
...
@@ -696,14 +696,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self
.
updateRoleMappingsFor
(
document
)
# Execute the "after" script.
if
tdef
is
not
None
and
tdef
.
getAfterScriptIdList
()
:
if
tdef
is
not
None
:
script_id_list
=
tdef
.
getAfterScriptIdList
()
kwargs
=
form_kw
sci
=
StateChangeInfo
(
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
for
script_id
in
script_id_list
:
script
=
self
.
_getOb
(
script_id
,
None
)
if
script
:
if
script_id_list
:
kwargs
=
form_kw
sci
=
StateChangeInfo
(
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
for
script_id
in
script_id_list
:
script
=
self
.
_getOb
(
script_id
)
# Script can be either script or workflow method
if
script_id
in
old_sdef
.
getDestinationIdList
()
and
\
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