Commit 4e74d660 authored by Łukasz Nowak's avatar Łukasz Nowak

CMFActivity: Use proper invalid_only in hasErrorActivity

Instead of using obsolete processing_node parameter, use invalid_onlym
with True, in order to check if there are activities with error.

As INVOKE_ERROR_STATE is needed only in SQLBase, move it there and so drop it
from ActiveObject and ActiveProcess.
parent 13c6fdf2
...@@ -39,9 +39,6 @@ from Products.CMFCore import permissions ...@@ -39,9 +39,6 @@ from Products.CMFCore import permissions
DEFAULT_ACTIVITY = 'SQLDict' DEFAULT_ACTIVITY = 'SQLDict'
# Processing node are used to store processing state or processing node
INVOKE_ERROR_STATE = -2
_DEFAULT_ACTIVATE_PARAMETER_KEY = 'default_activate_parameter' _DEFAULT_ACTIVATE_PARAMETER_KEY = 'default_activate_parameter'
class ActiveObject(ExtensionClass.Base): class ActiveObject(ExtensionClass.Base):
...@@ -143,7 +140,7 @@ class ActiveObject(ExtensionClass.Base): ...@@ -143,7 +140,7 @@ class ActiveObject(ExtensionClass.Base):
def hasErrorActivity(self, **kw): def hasErrorActivity(self, **kw):
"""Tells if there is failed activities for this object. """Tells if there is failed activities for this object.
""" """
return self.hasActivity(processing_node = INVOKE_ERROR_STATE) return self.hasActivity(only_invalid=True)
def getActiveProcess(self): def getActiveProcess(self):
path = getActivityRuntimeEnvironment()._message.active_process path = getActivityRuntimeEnvironment()._message.active_process
......
...@@ -33,7 +33,6 @@ from Products.ERP5Type.Base import Base ...@@ -33,7 +33,6 @@ from Products.ERP5Type.Base import Base
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from Products.ERP5Type.ConflictFree import ConflictFreeLog from Products.ERP5Type.ConflictFree import ConflictFreeLog
from BTrees.Length import Length from BTrees.Length import Length
from Products.CMFActivity.ActiveObject import INVOKE_ERROR_STATE
from random import randrange from random import randrange
from .ActiveResult import ActiveResult from .ActiveResult import ActiveResult
...@@ -147,7 +146,7 @@ class ActiveProcess(Base): ...@@ -147,7 +146,7 @@ class ActiveProcess(Base):
""" """
Tells if some attached activities are in a error Tells if some attached activities are in a error
""" """
return self.hasActivity(processing_node = INVOKE_ERROR_STATE) return self.hasActivity(only_invalid=True)
def getCreationDate(self): def getCreationDate(self):
""" """
......
...@@ -35,7 +35,6 @@ from zLOG import LOG, TRACE, INFO, WARNING, ERROR, PANIC ...@@ -35,7 +35,6 @@ from zLOG import LOG, TRACE, INFO, WARNING, ERROR, PANIC
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from Products.CMFActivity.ActivityTool import ( from Products.CMFActivity.ActivityTool import (
Message, MESSAGE_NOT_EXECUTED, MESSAGE_EXECUTED, SkippedMessage) Message, MESSAGE_NOT_EXECUTED, MESSAGE_EXECUTED, SkippedMessage)
from Products.CMFActivity.ActiveObject import INVOKE_ERROR_STATE
from Products.CMFActivity.ActivityRuntimeEnvironment import ( from Products.CMFActivity.ActivityRuntimeEnvironment import (
DEFAULT_MAX_RETRY, ActivityRuntimeEnvironment, getTransactionalVariable) DEFAULT_MAX_RETRY, ActivityRuntimeEnvironment, getTransactionalVariable)
from Queue import Queue, VALIDATION_ERROR_DELAY, VALID, INVALID_PATH from Queue import Queue, VALIDATION_ERROR_DELAY, VALID, INVALID_PATH
...@@ -43,6 +42,7 @@ from Products.CMFActivity.Errors import ActivityFlushError ...@@ -43,6 +42,7 @@ from Products.CMFActivity.Errors import ActivityFlushError
# TODO: Limit by size in bytes instead of number of rows. # TODO: Limit by size in bytes instead of number of rows.
MAX_MESSAGE_LIST_SIZE = 100 MAX_MESSAGE_LIST_SIZE = 100
INVOKE_ERROR_STATE = -2
def sort_message_key(message): def sort_message_key(message):
# same sort key as in SQLBase.getMessageList # same sort key as in SQLBase.getMessageList
......
...@@ -34,7 +34,7 @@ from Testing import ZopeTestCase ...@@ -34,7 +34,7 @@ from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.CMFActivity.ActiveObject import INVOKE_ERROR_STATE from Products.CMFActivity.Activity.SQLBase import INVOKE_ERROR_STATE
from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY
from Products.CMFActivity.Activity.SQLDict import SQLDict from Products.CMFActivity.Activity.SQLDict import SQLDict
import Products.CMFActivity.ActivityTool import Products.CMFActivity.ActivityTool
......
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