diff --git a/product/ERP5Type/patches/CMFBTreeFolder.py b/product/ERP5Type/patches/CMFBTreeFolder.py index c6acdeed724fd5003364dbc9dc741615f6a2364a..d06efc56095e659455f5542023e28776985db5cb 100644 --- a/product/ERP5Type/patches/CMFBTreeFolder.py +++ b/product/ERP5Type/patches/CMFBTreeFolder.py @@ -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: diff --git a/product/ERP5Type/patches/CMFCatalogAware.py b/product/ERP5Type/patches/CMFCatalogAware.py index 98d466a6f0f89717b329e44ae3c829552ffcb7ab..05be3556d353160726dbcecbcc4d7fde8379a9df 100644 --- a/product/ERP5Type/patches/CMFCatalogAware.py +++ b/product/ERP5Type/patches/CMFCatalogAware.py @@ -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) diff --git a/product/ERP5Type/patches/DCWorkflow.py b/product/ERP5Type/patches/DCWorkflow.py index ba179517abf96670b293635715306b1cc5cd3aaa..499459afb4dd6bb787295350d3f79d2e9acbb576 100644 --- a/product/ERP5Type/patches/DCWorkflow.py +++ b/product/ERP5Type/patches/DCWorkflow.py @@ -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') diff --git a/product/ERP5Type/patches/WorkflowTool.py b/product/ERP5Type/patches/WorkflowTool.py index c208d4b25de53bd8fae20cb0fdfae1d3588e4f55..37c49ec2dc6a6f8d5574be9acd7ae64103f7c9f2 100644 --- a/product/ERP5Type/patches/WorkflowTool.py +++ b/product/ERP5Type/patches/WorkflowTool.py @@ -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: