Commit d40e9600 authored by Julien Muchembled's avatar Julien Muchembled

Notify when an activity is not executable (-3)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34303 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0834758e
...@@ -196,6 +196,7 @@ class SQLBase: ...@@ -196,6 +196,7 @@ class SQLBase:
# something is missing (context object cannot be found, method cannot # something is missing (context object cannot be found, method cannot
# be accessed on object). # be accessed on object).
non_executable_message_list.append(uid) non_executable_message_list.append(uid)
notify_user_list.append((m, False))
if deletable_uid_list: if deletable_uid_list:
try: try:
self._retryOnLockError(activity_tool.SQLBase_delMessage, self._retryOnLockError(activity_tool.SQLBase_delMessage,
......
...@@ -323,7 +323,9 @@ class Message(BaseMessage): ...@@ -323,7 +323,9 @@ class Message(BaseMessage):
call_traceback = 'Created at:\n%s' % self.call_traceback call_traceback = 'Created at:\n%s' % self.call_traceback
fail_count = self.line.retry + 1 fail_count = self.line.retry + 1
if retry: if m.getExecutionState() == MESSAGE_NOT_EXECUTABLE:
message = "Not executable activity"
elif retry:
message = "Pending activity already failed %s times" % fail_count message = "Pending activity already failed %s times" % fail_count
else: else:
message = "Activity failed" message = "Activity failed"
......
...@@ -2336,11 +2336,19 @@ class TestCMFActivity(ERP5TypeTestCase): ...@@ -2336,11 +2336,19 @@ class TestCMFActivity(ERP5TypeTestCase):
Message.notifyUser = fake_notifyUser Message.notifyUser = fake_notifyUser
Organisation.failingMethod = failingMethod Organisation.failingMethod = failingMethod
try: try:
obj.activate(activity=activity, priority=6).failingMethod() # MESSAGE_NOT_EXECUTED
obj.activate(activity=activity).failingMethod()
get_transaction().commit() get_transaction().commit()
self.assertEqual(len(notification_done), 0) self.assertEqual(len(notification_done), 0)
self.flushAllActivities(silent=1, loop_size=100) self.flushAllActivities(silent=1, loop_size=100)
self.assertEqual(len(notification_done), 1) self.assertEqual(len(notification_done), 1)
# MESSAGE_NOT_EXECUTABLE
obj.getParentValue()._delObject(obj.getId())
obj.activate(activity=activity).getId()
get_transaction().commit()
self.assertEqual(len(notification_done), 1)
self.flushAllActivities(silent=1, loop_size=100)
self.assertEqual(len(notification_done), 2)
finally: finally:
Message.notifyUser = original_notifyUser Message.notifyUser = original_notifyUser
delattr(Organisation, 'failingMethod') delattr(Organisation, 'failingMethod')
......
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