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

CMFActivity: stop using getToolByName

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