Commit 1186a65a authored by Hardik Juneja's avatar Hardik Juneja

CMFActivity: Allow optional signature parameter

parent b1517b84
......@@ -83,6 +83,12 @@ class Queue(object):
def initialize(self, activity_tool, clear):
pass
def register(self, activity_buffer, activity_tool, message):
pass
def activateResult(self, active_process, result, signature=None):
pass
def deleteMessage(self, activity_tool, m):
if not getattr(m, 'is_deleted', 0):
# We try not to delete twice
......
......@@ -123,7 +123,7 @@ class SQLBase(Queue):
self.registerMessage(activity_buffer, activity_tool, message)
def activateResult(self, active_process, result, signature=None):
active_process.appendResult(result)
active_process.appendResult(result)
def prepareQueueMessageList(self, activity_tool, message_list):
registered_message_list = [m for m in message_list if m.is_registered]
......
......@@ -81,7 +81,8 @@ class SQLJoblib(SQLDict):
"""
assert not message.is_registered, message
message.is_registered = True
message.activity_kw['signature'] = sqljoblib_hash(message.args)
if not 'signature' in message.activity_kw:
message.activity_kw['signature'] = sqljoblib_hash(message.args)
if activity_buffer.activity_tool is None:
self.activity_tool = activity_tool
self.prepareMessage(activity_tool, message)
......
......@@ -2112,11 +2112,11 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
try:
# Adds two same activities.
activity_tool.activate(activity='SQLJoblib', after_tag='foo', priority=2,
tag='a', signature=555666).doSomething(other_tag='a')
tag='a').doSomething(other_tag='a')
self.commit()
uid1, = [x.uid for x in activity_tool.getMessageList()]
activity_tool.activate(activity='SQLJoblib', after_tag='bar', priority=1,
tag='a', signature=555666).doSomething(other_tag='a')
tag='a').doSomething(other_tag='a')
self.commit()
self.assertEqual(len(activity_tool.getMessageList()), 2)
activity_tool.distribute()
......
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