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
Hardik Juneja
erp5
Commits
724155ba
Commit
724155ba
authored
May 05, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interaction.py: remove unused functions.
parent
35bc8338
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
123 deletions
+1
-123
product/ERP5Workflow/Document/Interaction.py
product/ERP5Workflow/Document/Interaction.py
+1
-123
No files found.
product/ERP5Workflow/Document/Interaction.py
View file @
724155ba
...
...
@@ -41,6 +41,7 @@ from Products.DCWorkflow.Expression import StateChangeInfo
from
Products.ERP5Type.id_as_reference
import
IdAsReferenceMixin
class
Interaction
(
IdAsReferenceMixin
(
'interaction_'
,
"prefix"
),
XMLObject
):
"""
An ERP5 Interaction.
"""
...
...
@@ -84,12 +85,6 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject):
PropertySheet
.
Interaction
,
)
def
_getObjectByRef
(
self
,
ref
):
for
ob
in
self
:
if
wf
.
getRef
()
==
ref
:
return
ob
return
None
def
getGuardSummary
(
self
):
res
=
None
if
self
.
guard
is
not
None
:
...
...
@@ -128,123 +123,6 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject):
elif
self
.
guard
.
expr
!=
self
.
getExpression
():
self
.
guard
.
expr
=
self
.
getExpression
()
def
execute
(
self
,
ob
,
form_kw
=
None
):
LOG
(
' Calling interaction %s'
%
self
.
getId
(),
WARNING
,
' in Interaction.py'
)
### getRef
### zwj: What will be done this part
### this part shoud be called in Base.py as transition be called.
# 1: execute before script;
# 2: execute after script;
# 3: Queue before commit script;
# 4: execute activity script.
# Initialize variables
former_status
=
{}
econtext
=
None
sci
=
None
# Figure out the old and new states.
if
form_kw
is
None
:
form_kw
=
{}
workflow
=
self
.
getParent
()
assert
self
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
#status = workflow.getCurrentStatusDict(ob)
sci
=
StateChangeInfo
(
ob
,
workflow
,
former_status
,
self
,
None
,
None
,
kwargs
=
form_kw
)
# Execute before script
before_script_list
=
[]
before_script_list
.
append
(
self
.
getBeforeScriptName
())
if
before_script_list
!=
[]
and
self
.
getBeforeScriptName
()
is
not
None
:
for
script_name
in
before_script_list
:
script
=
workflow
.
_getOb
(
script_name
)
### _getObjectByRef
# Pass lots of info to the script in a single parameter.
script
.
execute
(
sci
)
# Update variables.
tdef_exprs
=
self
.
var_exprs
if
tdef_exprs
is
None
:
tdef_exprs
=
{}
for
vdef
in
workflow
.
objectValues
(
portal_type
=
'Variable'
):
id
=
vdef
.
getId
()
### getRef
if
not
vdef
.
for_status
:
continue
expr
=
None
if
id
in
tdef_exprs
:
expr
=
tdef_exprs
[
id
]
elif
not
vdef
.
update_always
and
id
in
former_status
:
# Preserve former value
value
=
former_status
[
id
]
else
:
if
vdef
.
default_expr
is
not
None
:
expr
=
vdef
.
default_expr
else
:
value
=
vdef
.
default_value
if
expr
is
not
None
:
# Evaluate an expression.
if
econtext
is
None
:
# Lazily create the expression context.
if
sci
is
None
:
sci
=
StateChangeInfo
(
ob
,
workflow
,
former_status
,
self
,
None
,
None
,
None
)
econtext
=
Expression_createExprContext
(
sci
)
value
=
expr
(
econtext
)
#status[id] = value
# Execute the "after" script.
after_script_list
=
[]
after_script_list
.
append
(
self
.
getAfterScriptName
())
if
after_script_list
!=
[]
and
self
.
getAfterScriptName
()
is
not
None
:
for
script_name
in
after_script_list
:
script
=
workflow
.
_getOb
(
script_name
)
### getObjectByRef
LOG
(
'Accessing afterscript: %s'
%
script_name
,
WARNING
,
'in Interaction.py'
)
# Pass lots of info to the script in a single parameter.
script
.
execute
(
sci
)
# May throw an exception
# Queue the "Before Commit" scripts
sm
=
getSecurityManager
()
before_commit_script_list
=
[]
before_commit_script_list
.
append
(
self
.
getBeforeCommitScriptName
())
if
before_commit_script_list
!=
[]
and
self
.
getBeforeCommitScriptName
()
is
not
None
:
for
script_name
in
before_commit_script_list
:
transaction
.
get
().
addBeforeCommitHook
(
self
.
_before_commit
,
(
sci
,
script_name
,
sm
))
# Execute "activity" scripts
activity_script_list
=
[]
activity_script_list
.
append
(
self
.
getActivateScriptName
())
if
activity_script_list
!=
[]
and
self
.
getActivateScriptName
()
is
not
None
:
for
script_name
in
activity_script_list
:
workflow
.
activate
(
activity
=
'SQLQueue'
)
\
.
activeScript
(
script_name
,
ob
.
getRelativeUrl
(),
former_status
,
self
.
getId
())
### getRef
def
_before_commit
(
self
,
sci
,
script_name
,
security_manager
):
# check the object still exists before calling the script
ob
=
sci
.
object
workflow
=
self
.
getParent
()
while
ob
.
isTempObject
():
ob
=
ob
.
getParentValue
()
if
aq_base
(
self
.
unrestrictedTraverse
(
ob
.
getPhysicalPath
(),
None
))
is
\
aq_base
(
ob
):
current_security_manager
=
getSecurityManager
()
try
:
# Who knows what happened to the authentication context
# between here and when the interaction was executed... So we
# need to switch to the security manager as it was back then
setSecurityManager
(
security_manager
)
workflow
.
_getOb
(
script_name
)(
sci
)
### _getObjectByRef
finally
:
setSecurityManager
(
current_security_manager
)
def
activeScript
(
self
,
script_name
,
ob_url
,
former_status
):
workflow
=
self
.
getParent
()
script
=
workflow
.
_getOb
(
script_name
)
### _getObjectByRef
ob
=
self
.
unrestrictedTraverse
(
ob_url
)
sci
=
StateChangeInfo
(
ob
,
worfklow
,
former_status
,
self
,
None
,
None
,
kwargs
=
kw
)
script
.
execute
(
sci
)
def
getMethodId
(
self
):
if
type
(
self
.
method_id
)
is
type
(
''
):
self
.
method_id
=
self
.
method_id
.
split
()
...
...
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