Commit 8c2f568d authored by iv's avatar iv

WF-PERF-HACK: try redefining getXXXList to avoid using category tool

parent 769ed8ce
......@@ -32,6 +32,8 @@
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple>
<string>order</string>
<string>parent</string>
</tuple>
</value>
</item>
......@@ -51,7 +53,7 @@
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: []</string> </value>
<value> <string>python: list( portal.getPortalAcquisitionMovementTypeList() + portal.getPortalItemTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList() + portal.getPortalSupplyTypeList() + portal.getPortalSupplyPathTypeList() + portal.getPortalProjectTypeList() + portal.getPortalOpenOrderTypeList() + portal.getPortalCalendarTypeList())</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
......
......@@ -115,3 +115,23 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject,
parent = self.getParentValue()
return [parent._getOb(transition_id) for transition_id
in self.getActivateScriptIdList()]
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getActivateScriptList')
def getActivateScriptList(self):
"""
returns the list of activate script
"""
return [path.split('/')[-1] for path in self.getCategoryList()
if path.startswith('activate_script')]
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeCommitScriptList')
def getBeforeCommitScriptList(self):
"""
returns the list of before commit script
"""
return [path.split('/')[-1] for path in self.getCategoryList()
if path.startswith('before_commit_script')]
\ No newline at end of file
......@@ -90,6 +90,19 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
possible_transition_list.append(tr_path)
self.setCategoryList(possible_transition_list)
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationList')
def getDestinationList(self):
"""
this getter is redefined to improve performance:
instead of getting all the transition objects from the destination list
to then use their ids, extract the information from the string
"""
return [path.split('/')[-1] for path in self.getCategoryList() if path.startswith('destination')]
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationIdList')
def getDestinationIdList(self):
......@@ -100,6 +113,8 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
"""
return [path.split('/')[-1] for path in self.getDestinationList()]
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationValueList')
def getDestinationValueList(self):
"""
this getter is redefined to improve performance:
......
......@@ -82,6 +82,28 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject,
# they use the categories paths directly and string operations
# instead of traversing from the portal to get the objects
# in order to have their id or value
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeScriptList')
def getBeforeScriptList(self):
"""
returns the list of before script
"""
return [path.split('/')[-1] for path in self.getCategoryList()
if path.startswith('before_script')]
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getAfterScriptList')
def getAfterScriptList(self):
"""
returns the list of after script
"""
return [path.split('/')[-1] for path in self.getCategoryList()
if path.startswith('after_script')]
security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeScriptIdList')
def getBeforeScriptIdList(self):
......
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