Commit 49d71203 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Even if expanded_object_list is empty, invokeGroup must deal with messages.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5751 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4e89e254
...@@ -652,47 +652,49 @@ class ActivityTool (Folder, UniqueObject): ...@@ -652,47 +652,49 @@ class ActivityTool (Folder, UniqueObject):
LOG('WARNING ActivityTool', 0, LOG('WARNING ActivityTool', 0,
'Could not call method %s on object %s' % (m.method_id, m.object_path), error=sys.exc_info()) 'Could not call method %s on object %s' % (m.method_id, m.object_path), error=sys.exc_info())
if len(expanded_object_list) > 0: try:
try: if len(expanded_object_list) > 0:
method = self.unrestrictedTraverse(method_id) method = self.unrestrictedTraverse(method_id)
# FIXME: how to pass parameters? # FIXME: how to pass parameters?
# FIXME: how to apply security here? # FIXME: how to apply security here?
# NOTE: expanded_object_list must be set to failed objects by the callee. # NOTE: expanded_object_list must be set to failed objects by the callee.
# If it fully succeeds, expanded_object_list must be empty when returning. # If it fully succeeds, expanded_object_list must be empty when returning.
result = method(expanded_object_list) result = method(expanded_object_list)
except:
# In this case, the group method completely failed.
for m in new_message_list:
m.is_executed = 0
m.exc_type = sys.exc_info()[0]
LOG('WARNING ActivityTool', 0,
'Could not call method %s on objects %s' % (method_id, expanded_object_list), error=sys.exc_info())
else: else:
# Obtain all indices of failed messages. Note that this can be a partial failure. result = None
failed_message_dict = {} except:
for obj in expanded_object_list: # In this case, the group method completely failed.
path = obj.getPath() for m in new_message_list:
i = path_dict[path] m.is_executed = 0
failed_message_dict[i] = None m.exc_type = sys.exc_info()[0]
LOG('WARNING ActivityTool', 0,
# Only for succeeded messages, an activity process is invoked (if any). 'Could not call method %s on objects %s' % (method_id, expanded_object_list), error=sys.exc_info())
for i in xrange(len(object_list)): else:
object = object_list[i] # Obtain all indices of failed messages. Note that this can be a partial failure.
m = new_message_list[i] failed_message_dict = {}
if i in failed_message_dict: for obj in expanded_object_list:
path = obj.getPath()
i = path_dict[path]
failed_message_dict[i] = None
# Only for succeeded messages, an activity process is invoked (if any).
for i in xrange(len(object_list)):
object = object_list[i]
m = new_message_list[i]
if i in failed_message_dict:
m.is_executed = 0
LOG('ActivityTool', WARNING,
'the method %s partially failed on object %s' % (m.method_id, m.object_path,))
else:
try:
m.activateResult(self, result, object)
m.is_executed = 1
except:
m.is_executed = 0 m.is_executed = 0
m.exc_type = sys.exc_info()[0]
LOG('ActivityTool', WARNING, LOG('ActivityTool', WARNING,
'the method %s partially failed on object %s' % (m.method_id, m.object_path,)) 'Could not call method %s on object %s' % (m.method_id, m.object_path), error=sys.exc_info())
else:
try:
m.activateResult(self, result, object)
m.is_executed = 1
except:
m.is_executed = 0
m.exc_type = sys.exc_info()[0]
LOG('ActivityTool', WARNING,
'Could not call method %s on object %s' % (m.method_id, m.object_path), error=sys.exc_info())
def newMessage(self, activity, path, active_process, activity_kw, method_id, *args, **kw): def newMessage(self, activity, path, active_process, activity_kw, method_id, *args, **kw):
# Some Security Cheking should be made here XXX # Some Security Cheking should be made here XXX
global is_initialized global is_initialized
......
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