[Erp5-report] r39157 jm - /erp5/trunk/products/ERP5Type/patches/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 14 15:43:44 CEST 2010


Author: jm
Date: Thu Oct 14 15:43:33 2010
New Revision: 39157

URL: http://svn.erp5.org?rev=39157&view=rev
Log:
Performance: get tools from the portal instead of relying on acquisition

Modified:
    erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py
    erp5/trunk/products/ERP5Type/patches/CMFCatalogAware.py
    erp5/trunk/products/ERP5Type/patches/DCWorkflow.py
    erp5/trunk/products/ERP5Type/patches/WorkflowTool.py

Modified: erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py?rev=39157&r1=39156&r2=39157&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py [utf8] Thu Oct 14 15:43:33 2010
@@ -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(s
       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:

Modified: erp5/trunk/products/ERP5Type/patches/CMFCatalogAware.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CMFCatalogAware.py?rev=39157&r1=39156&r2=39157&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CMFCatalogAware.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/CMFCatalogAware.py [utf8] Thu Oct 14 15:43:33 2010
@@ -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, 
         # 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)
 

Modified: erp5/trunk/products/ERP5Type/patches/DCWorkflow.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/DCWorkflow.py?rev=39157&r1=39156&r2=39157&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/DCWorkflow.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/DCWorkflow.py [utf8] Thu Oct 14 15:43:33 2010
@@ -119,9 +119,7 @@ def DCWorkflowDefinition_listGlobalActio
     '''
     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_getWorklistVari
   """
   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')

Modified: erp5/trunk/products/ERP5Type/patches/WorkflowTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/WorkflowTool.py?rev=39157&r1=39156&r2=39157&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] Thu Oct 14 15:43:33 2010
@@ -448,10 +448,11 @@ def WorkflowTool_listActions(self, info=
         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:




More information about the Erp5-report mailing list