Commit a400bc98 authored by Yoshinori Okuji's avatar Yoshinori Okuji

getObjectList must be passed activity_tool. This caused a minor bug which...

getObjectList must be passed activity_tool. This caused a minor bug which miscalculates the number of grouped objects.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4200 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 54787dde
...@@ -33,6 +33,7 @@ from Queue import VALID, INVALID_ORDER, INVALID_PATH, EXCEPTION, MAX_PROCESSING_ ...@@ -33,6 +33,7 @@ from Queue import VALID, INVALID_ORDER, INVALID_PATH, EXCEPTION, MAX_PROCESSING_
from RAMDict import RAMDict from RAMDict import RAMDict
from Products.CMFActivity.ActiveObject import DISTRIBUTABLE_STATE, INVOKE_ERROR_STATE, VALIDATE_ERROR_STATE from Products.CMFActivity.ActiveObject import DISTRIBUTABLE_STATE, INVOKE_ERROR_STATE, VALIDATE_ERROR_STATE
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import sys
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -204,11 +205,12 @@ class SQLDict(RAMDict): ...@@ -204,11 +205,12 @@ class SQLDict(RAMDict):
# Count the number of objects to prevent too many objects. # Count the number of objects to prevent too many objects.
if m.hasExpandMethod(): if m.hasExpandMethod():
try: try:
count = len(m.getObjectList()) count = len(m.getObjectList(activity_tool))
except ConflictError: except ConflictError:
raise raise
except: except:
# Here, simply ignore an exception. The same exception should be handled later. # Here, simply ignore an exception. The same exception should be handled later.
LOG('SQLDict', 0, 'ignoring an exception from getObjectList', error=sys.exc_info())
count = 0 count = 0
else: else:
count = 1 count = 1
...@@ -238,6 +240,7 @@ class SQLDict(RAMDict): ...@@ -238,6 +240,7 @@ class SQLDict(RAMDict):
raise raise
except: except:
# Here, simply ignore an exception. The same exception should be handled later. # Here, simply ignore an exception. The same exception should be handled later.
LOG('SQLDict', 0, 'ignoring an exception from getObjectList', error=sys.exc_info())
pass pass
else: else:
count += 1 count += 1
...@@ -250,6 +253,9 @@ class SQLDict(RAMDict): ...@@ -250,6 +253,9 @@ class SQLDict(RAMDict):
get_transaction().commit() # Release locks before starting a potentially long calculation get_transaction().commit() # Release locks before starting a potentially long calculation
# Try to invoke # Try to invoke
if group_method_id is not None: if group_method_id is not None:
#LOG('SQLDict', 0, 'invoking a group method %s with %d objects (%d objects in expanded form)' % (group_method_id, len(message_list), count))
#for m in message_list:
# LOG('SQLDict', 0, '%r has objects %r' % (m, m.getObjectList(activity_tool)))
activity_tool.invokeGroup(group_method_id, message_list) activity_tool.invokeGroup(group_method_id, message_list)
else: else:
#LOG('SQLDict dequeueMessage', 0, 'invoke %s on %s' % (message_list[0].method_id, message_list[0].object_path)) #LOG('SQLDict dequeueMessage', 0, 'invoke %s on %s' % (message_list[0].method_id, message_list[0].object_path))
......
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