Commit e6033178 authored by Nicolas Dumazet's avatar Nicolas Dumazet

walk supply line list once instead of thrice


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35978 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c2e57d60
...@@ -97,16 +97,18 @@ class SupplyChain(Path, XMLObject): ...@@ -97,16 +97,18 @@ class SupplyChain(Path, XMLObject):
portal_type=self.supply_link_portal_type) portal_type=self.supply_link_portal_type)
# Search next link # Search next link
next_node_value = current_supply_link.getNextNodeValue() next_node_value = current_supply_link.getNextNodeValue()
next_supply_link_list = [x for x in supply_link_list if \
x.getCurrentNodeValue() == next_node_value] next_supply_link_list = []
# Prevent infinite loop next_production_list = []
if current_supply_link in next_supply_link_list: for supply_link in supply_link_list:
next_supply_link_list.remove(current_supply_link) if supply_link != current_supply_link and \
# Get only production node in the list, or return the entire list supply_link.getCurrentNodeValue() == next_node_value:
next_production_list = [x for x in next_supply_link_list \ next_supply_link_list.append(supply_link)
if x.isProductionSupplyLink()] if supply_link.isProductionSupplyLink():
next_production_list.append(supply_link)
if next_production_list != []: if next_production_list != []:
next_supply_link_list = next_production_list return next_production_list
return next_supply_link_list return next_supply_link_list
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
......
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