Commit 813f2f89 authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: stop using getToolByName

parent 12eda3c3
......@@ -29,7 +29,6 @@
import ExtensionClass
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from ActivityRuntimeEnvironment import getActivityRuntimeEnvironment
......@@ -123,8 +122,9 @@ class ActiveObject(ExtensionClass.Base):
security.declareProtected( permissions.ModifyPortalContent, 'flushActivity' )
def flushActivity(self, invoke=0, **kw):
activity_tool = getToolByName(self.getPortalObject(), 'portal_activities', None)
if activity_tool is None:
try:
activity_tool = self.getPortalObject().portal_activities
except AttributeError:
return # Do nothing if no portal_activities
# flush all activities related to this object
activity_tool.flush(self, invoke=invoke, **kw)
......@@ -143,8 +143,9 @@ class ActiveObject(ExtensionClass.Base):
def hasActivity(self, **kw):
"""Tells if there is pending activities for this object.
"""
activity_tool = getToolByName(self.getPortalObject(), 'portal_activities', None)
if activity_tool is None:
try:
activity_tool = self.getPortalObject().portal_activities
except AttributeError:
return 0 # Do nothing if no portal_activities
return activity_tool.hasActivity(self, **kw)
......
......@@ -44,7 +44,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from Products.CMFCore.utils import UniqueObject, _getAuthenticatedUser, getToolByName
from Products.CMFCore.utils import UniqueObject, _getAuthenticatedUser
from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from Acquisition import aq_base, aq_inner, aq_parent
from ActivityBuffer import ActivityBuffer
......@@ -922,9 +922,10 @@ class ActivityTool (Folder, UniqueObject):
# with TimerService we have the same REQUEST over multiple
# portals, we clear this cache to make sure the cache doesn't
# contains skins from another portal.
stool = getToolByName(self, 'portal_skins', None)
if stool is not None:
stool.changeSkin(None)
try:
self.getPortalObject().portal_skins.changeSkin(None)
except AttributeError:
pass
# call tic for the current processing_node
# the processing_node numbers are the indices of the elements in the node tuple +1
......@@ -1321,7 +1322,7 @@ class ActivityTool (Folder, UniqueObject):
"""
Clear all activities and recreate tables.
"""
folder = getToolByName(self, 'portal_skins').activity
folder = self.getPortalObject().portal_skins
# Obtain all pending messages.
message_list_dict = {}
......
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