Commit 8251c775 authored by iv's avatar iv

ERP5Workflow: avoid calling getToolByName

this is more expensive than getting tool directly from getPortalObject
or even taking the parent of the workflow object to get the workflow tool
parent b8881e47
......@@ -40,7 +40,6 @@ from DocumentTemplate.DT_Util import TemplateDict
from lxml import etree
from lxml.etree import Element, SubElement
from Products.CMFCore.Expression import Expression
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowException, ObjectDeleted,\
ObjectMoved
from Products.DCWorkflow.DCWorkflow import ValidationFailed
......@@ -696,7 +695,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject, CacheCookieMixin):
econtext = None
moved_exc = None
validation_exc = None
tool = getToolByName(self, 'portal_workflow')
tool = self.getParentValue()
# Figure out the old and new states.
state_var = self.getStateVariable()
......
......@@ -735,7 +735,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if error_value[0] != 1146:
raise
self.Base_zCreateWorklistTable()
portal_catalog = getToolByName(self, 'portal_catalog')
portal_catalog = self.getPortalObject().portal_catalog
search_result = portal_catalog.unrestrictedSearchResults
sql_catalog = portal_catalog.getSQLCatalog()
table_column_id_set = ImmutableSet(
......@@ -1053,7 +1053,7 @@ class WorkflowMethod( Method ):
""" Invoke the wrapped method, and deal with the results.
"""
wf = getToolByName(instance, 'portal_workflow', None)
wf = self.getPortalObject()._getOb('portal_workflow', None)
if wf is None or not hasattr(wf, 'wrapWorkflowMethod'):
# No workflow tool found.
try:
......
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