Commit 762c1872 authored by Nicolas Dumazet's avatar Nicolas Dumazet

delay interaction so it happens once at end of transaction

This avoids resetting several times the dynamic methods,
and should mean faster BT installation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42785 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1ee48e8f
......@@ -28,11 +28,13 @@
##############################################################################
from Products.ERP5Type.Interactor.Interactor import Interactor
import transaction
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
class PortalTypeClassInteractor(Interactor):
"""
This interactor handles all the calls to resetDynamicDocuments
which must be trigered whenever some parts of ERP5
which must be trigered whenever some parts of ERP5
are modified and require to generate again accessors
and dynamic properties.
"""
......@@ -52,12 +54,20 @@ class PortalTypeClassInteractor(Interactor):
def resetDynamic(self, method_call_object, *args, **kw):
"""
Call resetDynamicDocuments
Call resetDynamicDocuments at the end of the transaction
"""
from Products.ERP5.ERP5Site import getSite
# method_call_object might be an unwrapped DCWorflowDefinition method,
# no even belonging to a container.
portal = getSite()
types_tool = getattr(portal, 'portal_types', None)
if types_tool is not None:
types_tool.resetDynamicDocuments()
if types_tool is None:
return
# XXX this could be a generic doOnceAtEndOfTransaction in
# Interactor baseclass
tv = getTransactionalVariable()
key = 'Interactor.PortalTypeClassInteractor.resetDynamic'
if key not in tv:
tv[key] = None
transaction.get().addBeforeCommitHook(types_tool.resetDynamicDocuments)
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