From 31de6f98b74145eb2673b1801697d050cf1d0687 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 10 Nov 2009 18:17:53 +0000 Subject: [PATCH] Remove 2 other calls to reindexObject(Security) when creating an object When an object was created, 2 activities were created: immediateReindexObject and recursiveImmediateReindexObject This wasn't a major issue before [29672] because they have same group_method_id Now that validated activities are executed in random order, 50% more activities would be executed in 'tic' tests of testPerformance. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30490 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/ERP5Type.py | 8 +++++--- product/ERP5Type/patches/WorkflowTool.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 product/ERP5Type/ERP5Type.py diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py old mode 100644 new mode 100755 index a918bed715..31bb9e660f --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -29,7 +29,7 @@ import Products from Products.CMFCore.TypesTool import FactoryTypeInformation from Products.CMFCore.Expression import Expression from Products.CMFCore.exceptions import AccessControl_Unauthorized -from Products.CMFCore.utils import _checkPermission +from Products.CMFCore.utils import _checkPermission, getToolByName from Products.ERP5Type import interfaces, Constraint, Permissions, PropertySheet from Products.ERP5Type.Base import getClassPropertyList from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod @@ -370,8 +370,10 @@ class ERP5TypeInformation(XMLObject, # notify workflow after generating local roles, in order to prevent # Unauthorized error on transition's condition - if hasattr(aq_base(ob), 'notifyWorkflowCreated'): - ob.notifyWorkflowCreated() + workflow_tool = getToolByName(self, 'portal_workflow', None) + if workflow_tool is not None: + for workflow in workflow_tool.getWorkflowsFor(ob): + workflow.notifyCreated(ob) init_script = self.getTypeInitScriptId() if init_script: diff --git a/product/ERP5Type/patches/WorkflowTool.py b/product/ERP5Type/patches/WorkflowTool.py index 3d5e6c9c0c..f362954069 100644 --- a/product/ERP5Type/patches/WorkflowTool.py +++ b/product/ERP5Type/patches/WorkflowTool.py @@ -782,3 +782,6 @@ def WorkflowTool_isTransitionPossible(self, ob, transition_id, wf_id=None): return 0 WorkflowTool.isTransitionPossible = WorkflowTool_isTransitionPossible + +WorkflowTool._reindexWorkflowVariables = lambda self, ob: \ + hasattr(aq_base(ob), 'reindexObjectSecurity') and ob.reindexObjectSecurity() -- 2.30.9