Commit 02791ba1 authored by Vincent Pelletier's avatar Vincent Pelletier

Products.CMFActivity: Inverse dequeueMessage return value

dequeueMessage used to return False when something was done, and True
otherwise. The only caller which uses that value then reverses it, causing
a double-negative which makes the code confusing to read.
Inverse the meaning of the return value, getting rid of this double-
negation.
parent 0be87a35
......@@ -351,7 +351,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# XXX: duplicate ActivityTool.tic, without locking as we are being
# multiple activity nodes in a single process.
for activity in ActivityTool.activity_dict.itervalues():
while not activity.dequeueMessage(activity_tool, node_id, ()):
while activity.dequeueMessage(activity_tool, node_id, ()):
pass
# Monkey-patch catalog to synchronise between main thread and the
# isolated transaction.
......
......@@ -1038,7 +1038,7 @@ CREATE TABLE %s (
self.finalizeMessageExecution(activity_tool, message_list,
uid_to_duplicate_uid_list_dict)
transaction.commit()
return not message_list
return bool(message_list)
def deleteMessageList(self, db, uid_list):
db.query("DELETE FROM %s WHERE uid IN (%s)" % (
......
......@@ -1387,7 +1387,7 @@ class ActivityTool (BaseTool):
activity_list.sort(key=sort_key) # stable sort
for i, activity in enumerate(activity_list):
# Transaction processing is the responsability of the activity
if not activity.dequeueMessage(inner_self, processing_node,
if activity.dequeueMessage(inner_self, processing_node,
node_family_id_set):
activity_list.append(activity_list.pop(i))
break
......
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