Commit 31de6f98 authored by Julien Muchembled's avatar Julien Muchembled

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
parent 88b2e048
......@@ -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:
......
......@@ -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()
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