Commit e65ddc0a authored by Sebastien Robin's avatar Sebastien Robin

removed all unused methods


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1857 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64f3498c
......@@ -113,113 +113,6 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
from Products.DCWorkflow.Scripts import Scripts
self._addObject(Scripts('scripts'))
def _executeTransition(self, ob, tdef=None, kwargs=None):
'''
Private method.
Puts object in a new state.
'''
sci = None
econtext = None
moved_exc = None
# Figure out the old and new states.
old_sdef = self._getWorkflowStateOf(ob)
old_state = old_sdef.getId()
if tdef is None:
new_state = self.initial_state
former_status = {}
else:
new_state = tdef.new_state_id
if not new_state:
# Stay in same state.
new_state = old_state
former_status = self._getStatusOf(ob)
new_sdef = self.states.get(new_state, None)
if new_sdef is None:
raise WorkflowException, (
'Destination state undefined: ' + new_state)
# Execute the "before" script.
if tdef is not None:
for script_name in tdef.script_name:
script = self.scripts[script_name]
# Pass lots of info to the script in a single parameter.
sci = StateChangeInfo(
ob, self, former_status, tdef, old_sdef, new_sdef, kwargs)
try:
script(sci) # May throw an exception.
except ObjectMoved, moved_exc:
ob = moved_exc.getNewObject()
# Re-raise after transition
# Update variables.
state_values = new_sdef.var_values
if state_values is None: state_values = {}
tdef_exprs = None
if tdef is not None: tdef_exprs = tdef.var_exprs
if tdef_exprs is None: tdef_exprs = {}
status = {}
for id, vdef in self.variables.items():
if not vdef.for_status:
continue
expr = None
if state_values.has_key(id):
value = state_values[id]
elif tdef_exprs.has_key(id):
expr = tdef_exprs[id]
elif not vdef.update_always and former_status.has_key(id):
# 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, self, former_status, tdef,
old_sdef, new_sdef, kwargs)
econtext = createExprContext(sci)
value = expr(econtext)
status[id] = value
# Update state.
status[self.state_var] = new_state
tool = aq_parent(aq_inner(self))
tool.setStatusOf(self.id, ob, status)
# Update role to permission assignments.
self.updateRoleMappingsFor(ob)
# Execute the "after" script.
if tdef is not None:
for after_script_name in tdef.after_script_name:
script = self.scripts[after_script_name]
# Pass lots of info to the script in a single parameter.
sci = StateChangeInfo(
ob, self, status, tdef, old_sdef, new_sdef, kwargs)
script(sci) # May throw an exception.
# Execute the "activate" script.
if tdef is not None:
for after_script_name in tdef.activate_script_name:
script = self.scripts[after_script_name]
# Pass lots of info to the script in a single parameter.
sci = StateChangeInfo(
ob.activate(activity='SQLQueue'), None, status, tdef, old_sdef, new_sdef, kwargs)
script(sci) # May throw an exception.
# Return the new state object.
if moved_exc is not None:
# Propagate the notification that the object has moved.
raise moved_exc
else:
return new_sdef
security.declarePrivate('listObjectActions')
def listObjectActions(self, info):
return []
......@@ -262,7 +155,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
Returns a true value if the given workflow is
automatic with the propper method_id
'''
return 0
#return 0 # Why this line ??? # I guess it should be used
for t in self.interactions.values():
if t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if method_id in t.method_id:
......@@ -279,28 +172,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
Allows the user to request a workflow action. This method
must perform its own security checks.
'''
for t in self.interactions.values():
tdef = None
if t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if method_id in t.method_id:
if t.portal_type_filter is None:
tdef = t
elif ob.getPortalType() in t.portal_type_filter:
tdef = t
if tdef is not None:
# Only execute if guard OK
if self._checkTransitionGuard(tdef, ob):
res = apply(func, args, kw)
try:
self._changeStateOf(ob, tdef)
except ObjectDeleted:
# Re-raise with a different result.
raise ObjectDeleted(res)
except ObjectMoved, ex:
# Re-raise with a different result.
raise ObjectMoved(ex.getNewObject(), res)
return res
return
security.declarePrivate('notifyBefore')
def notifyBefore(self, ob, action, args=None, kw=None):
......@@ -310,6 +182,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
a notifySuccess() or notifyException() can be expected later on.
The action usually corresponds to a method name.
'''
LOG('InteractionWorflow.notifyBefore, ob',0,ob)
for t in self.interactions.values():
tdef = None
if t.trigger_type == TRIGGER_AUTOMATIC:
......
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