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 @@ ...@@ -32,6 +32,8 @@
<key> <string>acquisition_base_category</string> </key> <key> <string>acquisition_base_category</string> </key>
<value> <value>
<tuple> <tuple>
<string>order</string>
<string>parent</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -51,7 +53,7 @@ ...@@ -51,7 +53,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <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>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
......
...@@ -114,4 +114,24 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject, ...@@ -114,4 +114,24 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject,
""" """
parent = self.getParentValue() parent = self.getParentValue()
return [parent._getOb(transition_id) for transition_id return [parent._getOb(transition_id) for transition_id
in self.getActivateScriptIdList()] in self.getActivateScriptIdList()]
\ No newline at end of file
# 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 ...@@ -90,6 +90,19 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
possible_transition_list.append(tr_path) possible_transition_list.append(tr_path)
self.setCategoryList(possible_transition_list) 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, security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationIdList') 'getDestinationIdList')
def getDestinationIdList(self): def getDestinationIdList(self):
...@@ -100,6 +113,8 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr ...@@ -100,6 +113,8 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr
""" """
return [path.split('/')[-1] for path in self.getDestinationList()] return [path.split('/')[-1] for path in self.getDestinationList()]
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationValueList')
def getDestinationValueList(self): def getDestinationValueList(self):
""" """
this getter is redefined to improve performance: this getter is redefined to improve performance:
......
...@@ -82,6 +82,28 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject, ...@@ -82,6 +82,28 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject,
# they use the categories paths directly and string operations # they use the categories paths directly and string operations
# instead of traversing from the portal to get the objects # instead of traversing from the portal to get the objects
# in order to have their id or value # 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, security.declareProtected(Permissions.AccessContentsInformation,
'getBeforeScriptIdList') 'getBeforeScriptIdList')
def getBeforeScriptIdList(self): def getBeforeScriptIdList(self):
...@@ -116,4 +138,4 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject, ...@@ -116,4 +138,4 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject,
""" """
parent = self.getParentValue() parent = self.getParentValue()
return [parent._getOb(transition_id) for transition_id return [parent._getOb(transition_id) for transition_id
in self.getAfterScriptIdList()] in self.getAfterScriptIdList()]
\ No newline at end of file
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