Commit 5ee04678 authored by Julien Muchembled's avatar Julien Muchembled

Performance: get tools from the portal instead of relying on acquisition

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39157 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fa8d121d
......@@ -18,7 +18,6 @@ try:
from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
except ImportError:
from Products.BTreeFolder2.CMFBTreeFolder import CMFBTreeFolder
from Products.CMFCore.utils import getToolByName
"""
This patch tries to give only portal types that are defined
......@@ -33,7 +32,7 @@ def CMFBTreeFolder_allowedContentTypes(self):
this folder.
"""
result = []
portal_types = getToolByName(self, 'portal_types')
portal_types = self.getPortalObject().portal_types
myType = portal_types.getTypeInfo(self)
if myType is not None:
......
......@@ -16,7 +16,6 @@
from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
from Acquisition import aq_base
from Products.CMFCore.utils import getToolByName
def reindexObject(self, idxs=[], *args, **kw):
"""
......@@ -31,7 +30,7 @@ def reindexObject(self, idxs=[], *args, **kw):
# Update the modification date.
if getattr(aq_base(self), 'notifyModified', None) is not None:
self.notifyModified()
catalog = getToolByName(self, 'portal_catalog', None)
catalog = self._getCatalogTool()
if catalog is not None:
catalog.reindexObject(self, idxs=idxs, *args, **kw)
......
......@@ -119,9 +119,7 @@ def DCWorkflowDefinition_listGlobalActions(self, info):
'''
if not self.worklists:
return None # Optimization
workflow_tool = getToolByName(self, 'portal_workflow')
workflow = getattr(workflow_tool, self.id)
_getPortalTypeListForWorkflow = CachingMethod(workflow.getPortalTypeListForWorkflow,
_getPortalTypeListForWorkflow = CachingMethod(self.getPortalTypeListForWorkflow,
id=('_getPortalTypeListForWorkflow', self.id),
cache_factory = 'erp5_ui_long')
portal_type_list = _getPortalTypeListForWorkflow()
......@@ -217,8 +215,6 @@ def DCWorkflowDefinition_getWorklistVariableMatchDict(self, info,
"""
if not self.worklists:
return None
workflow_tool = getToolByName(self, 'portal_workflow')
workflow = getattr(workflow_tool, self.id)
def getPortalTypeListForWorkflow(workflow_id):
workflow_tool = getToolByName(self, 'portal_workflow')
......
......@@ -448,10 +448,11 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
if a is not None:
worklist_dict[wf_id] = a
if len(worklist_dict):
is_anonymous = getToolByName(self, 'portal_membership').isAnonymousUser()
portal_url = getToolByName(self, 'portal_url')()
portal_catalog = getToolByName(self, 'portal_catalog')
if worklist_dict:
portal = self.getPortalObject()
is_anonymous = portal.portal_membership.isAnonymousUser()
portal_url = portal.portal_url()
portal_catalog = portal.portal_catalog
search_result = getattr(self, "Base_getCountFromWorklistTable", None)
use_cache = search_result is not None
if use_cache:
......
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