Commit 5b174fa5 authored by iv's avatar iv

ERP5Workflow: PERF: change getter for categories used in workflow

parent 47a6f5e3
......@@ -75,3 +75,31 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject,
PropertySheet.Interaction,
PropertySheet.Guard,
)
security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeCommitScriptIdList')
def getBeforeCommitScriptIdList(self):
"""
redefine this getter for performance improvements:
instead of , from the portal, getting the workflow
and taking its script or transition, and repeting this for
all 'before commit script', just get the parent once
and find the script names from the category paths
"""
parent = self.getParentValue()
return [parent._getOb(path.split('/')[-1])
for path in self.getBeforeCommitScriptList()]
security.declareProtected(Permissions.AccessContentsInformation,
'getActivateScriptIdList')
def getActivateScriptIdList(self):
"""
redefine this getter for performance improvements:
instead of , from the portal, getting the workflow
and taking its script or transition, and repeting this for
all 'activate script', just get the parent once
and find the script names from the category paths
"""
parent = self.getParentValue()
return [parent._getOb(path.split('/')[-1])
for path in self.getActivateScriptList()]
......@@ -77,3 +77,29 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject,
PropertySheet.Guard,
PropertySheet.ActionInformation,
)
security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeScriptIdList')
def getBeforeScriptIdList(self):
"""
redefine this getter for performance improvements:
instead of , from the portal, getting the workflow
and taking its script or transition, and repeting this for
all 'before script', just get the parent once
and find the script names from the category paths
"""
return [self.getParentValue()._getOb(path.split('/')[-1])
for path in self.getBeforeScriptList()]
security.declareProtected(Permissions.AccessContentsInformation,
'getAfterScriptIdList')
def getAfterScriptIdList(self):
"""
redefine this getter for performance improvements:
instead of , from the portal, getting the workflow
and taking its script or transition, and repeting this for
all 'after script', just get the parent once
and find the script names from the category paths
"""
return [self.getParentValue()._getOb(path.split('/')[-1])
for path in self.getAfterScriptList()]
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