Commit a860e63f authored by wenjie.zheng's avatar wenjie.zheng

InteractionWorkflow.py: remove duplicated code, function correction according...

InteractionWorkflow.py: remove duplicated code, function correction according to erp5 workflow structure.
parent 7de3aa7b
...@@ -216,26 +216,6 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -216,26 +216,6 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
transition_url=transition_url, transition_url=transition_url,
state=state) state=state)
security.declarePrivate('getCurrentStatusDict')
def getCurrentStatusDict(self, document):
"""
Get the current status dict.
"""
workflow_key = self._generateHistoryKey()
hist = document.workflow_history
# Copy is requested
result = hist.get(hist.keys()[-1])
#result = document.workflow_history[workflow_key][-1].copy()
return result
security.declarePrivate('_generateHistoryKey')
def _generateHistoryKey(self):
"""
Generate a key used in the workflow history.
"""
history_key = self.unrestrictedTraverse(self.getRelativeUrl()).getReference()
return history_key
security.declarePrivate('getinteraction_workflowVariableMatchDict') security.declarePrivate('getinteraction_workflowVariableMatchDict')
def getWorklistVariableMatchDict(self, info, check_guard=True): def getWorklistVariableMatchDict(self, info, check_guard=True):
return None return None
...@@ -272,7 +252,6 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -272,7 +252,6 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
security.declarePrivate('notifyBefore') security.declarePrivate('notifyBefore')
def notifyBefore(self, ob, transition_list, args=None, kw=None): def notifyBefore(self, ob, transition_list, args=None, kw=None):
status_dict = self.getCurrentStatusDict(ob)
if type(transition_list) in StringTypes: if type(transition_list) in StringTypes:
return return
...@@ -370,7 +349,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -370,7 +349,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
before_commit_script_list.append(tdef.getBeforeCommitScriptName()) before_commit_script_list.append(tdef.getBeforeCommitScriptName())
if before_commit_script_list != [] and tdef.getBeforeCommitScriptName() is not None: if before_commit_script_list != [] and tdef.getBeforeCommitScriptName() is not None:
for script_name in before_commit_script_list: for script_name in before_commit_script_list:
transaction.get().addBeforeCommitHook(tdef._before_commit, transaction.get().addBeforeCommitHook(self._before_commit,
(sci, script_name, sm)) (sci, script_name, sm))
# Execute "activity" scripts # Execute "activity" scripts
...@@ -395,7 +374,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -395,7 +374,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# between here and when the interaction was executed... So we # between here and when the interaction was executed... So we
# need to switch to the security manager as it was back then # need to switch to the security manager as it was back then
setSecurityManager(security_manager) setSecurityManager(security_manager)
self._getOb(script_name)(sci) self._getOb(script_name).execute(sci)
finally: finally:
setSecurityManager(current_security_manager) setSecurityManager(current_security_manager)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment