Commit 1138c067 authored by Jean-Paul Smets's avatar Jean-Paul Smets

bugfixes by JPS


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@678 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01e04353
......@@ -154,15 +154,19 @@ class Queue:
# Transaction Management
def prepareQueueMessage(self, activity_tool, m):
# Called to prepare transaction commit for queued messages
pass
def finishQueueMessage(self, activity_tool, m):
# Called to commit queued messages
pass
def prepareDequeueMessage(self, activity_tool, m):
# Called to prepare transaction commit for deleted messages
pass
def finishDequeueMessage(self, activity_tool, m):
# Called to commit deleted messages
pass
# Registration Management
......
......@@ -113,7 +113,7 @@ class RAMDict(Queue):
if object_path == m.object_path and (method_id is None or method_id == m.method_id):
LOG('CMFActivity RAMDict: ', 0, 'flushing object %s' % '/'.join(m.object_path))
if invoke: activity_tool.invoke(m)
self.deleteMessage(m)
self.deleteMessage(activity_tool, m)
else:
pass
#LOG('CMFActivity RAMDict: ', 0, 'not flushing object %s' % '/'.join(m.object_path))
......
......@@ -59,7 +59,7 @@ class RAMQueue(Queue):
return 1 # Go to sleep
m = self.queue[0]
activity_tool.invoke(m)
self.deleteMessage(m)
self.deleteMessage(activity_tool, m)
return 0 # Keep on ticking
def hasActivity(self, activity_tool, object, **kw):
......
......@@ -201,7 +201,7 @@ class SQLDict(RAMDict):
# Only invoke once (it would be different for a queue)
method_dict[method_id] = 1
m = self.loadMessage(line.message, uid = line.uid)
self.deleteMessage(m)
self.deleteMessage(activity_tool, m)
if invoke:
# First Validate
if m.validate(self, activity_tool):
......
......@@ -148,7 +148,7 @@ class SQLQueue(RAMQueue):
# Only invoke once (it would be different for a queue)
method_dict[method_id] = 1
m = self.loadMessage(line.message, uid = line.uid)
self.deleteMessage(m)
self.deleteMessage(activity_tool, m)
if invoke:
# First Validate
if m.validate(self, activity_tool):
......
......@@ -112,10 +112,9 @@ class Message:
object = activity_tool.unrestrictedTraverse(self.object_path)
# Change user if required (TO BE DONE)
# self.activity_kw
REQUEST = get_request()
REQUEST.active_process = self.active_process
activity_tool._v_active_process = self.active_process # Store the active_process as volatile thread variable
result = getattr(object, self.method_id)(*self.args, **self.kw)
if REQUEST.active_process is not None:
if activity_tool._v_active_process is not None:
active_process = activity_tool.getActiveProcess()
active_process.activateResult(Result(object,self.method_id,result)) # XXX Allow other method_id in future
self.is_executed = 1
......@@ -410,9 +409,9 @@ class ActivityTool (Folder, UniqueObject):
self.immediateReindexObject()
def getActiveProcess(self):
REQUEST = get_request()
if REQUEST.active_process:
return self.unrestrictedTraverse(REQUEST.active_process)
active_process = getattr(self, '_v_active_process')
if active_process:
return self.unrestrictedTraverse(active_process)
return None
......
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