Commit 0f1290b3 authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: code simplification

parent 09c8f83f
......@@ -143,12 +143,10 @@ class Queue(object):
return EXCEPTION
return VALID
def getDependentMessageList(self, activity_tool, message, **kw):
def getDependentMessageList(self, activity_tool, message):
message_list = []
for k, v in kw.iteritems():
result = activity_tool.getDependentMessageList(message, k, v)
if result:
message_list.extend(result)
for k, v in message.activity_kw.iteritems():
message_list += activity_tool.getDependentMessageList(message, k, v)
return message_list
def getExecutableMessageList(self, activity_tool, message, message_dict,
......@@ -174,7 +172,7 @@ class Queue(object):
cached_result = validation_text_dict.get(message.order_validation_text)
if cached_result is None:
message_list = message.getDependentMessageList(self, activity_tool)
message_list = self.getDependentMessageList(activity_tool, message)
transaction.commit() # Release locks.
if message_list:
# The result is not empty, so this message is not executable.
......@@ -197,8 +195,6 @@ class Queue(object):
message_dict[message.uid] = message
elif cached_result:
message_dict[message.uid] = message
else:
pass
def hasActivity(self, activity_tool, object, processing_node=None, active_process=None, **kw):
return 0
......
......@@ -308,9 +308,6 @@ class Message(BaseMessage):
check_order_validation=check_order_validation,
**self.activity_kw)
def getDependentMessageList(self, activity, activity_tool):
return activity.getDependentMessageList(activity_tool, self, **self.activity_kw)
def notifyUser(self, activity_tool, retry=False):
"""Notify the user that the activity failed."""
portal = activity_tool.getPortalObject()
......@@ -1422,13 +1419,13 @@ class ActivityTool (Folder, UniqueObject):
if not is_initialized:
self.initialize()
message_list = []
method_id = "_validate_%s" % validator_id
method_id = "_validate_" + validator_id
for activity in activity_dict.itervalues():
method = getattr(activity, method_id, None)
if method is not None:
result = method(aq_inner(self), message, validation_value)
if result:
message_list.extend([(activity, m) for m in result])
message_list += [(activity, m) for m in result]
return message_list
# Required for tests (time shift)
......
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