[Erp5-report] r35978 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/SupplyChain.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 4 05:28:49 CEST 2010
Author: nicolas.dumazet
Date: Fri Jun 4 05:28:49 2010
New Revision: 35978
URL: http://svn.erp5.org?rev=35978&view=rev
Log:
walk supply line list once instead of thrice
Modified:
erp5/trunk/products/ERP5/Document/SupplyChain.py
Modified: erp5/trunk/products/ERP5/Document/SupplyChain.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SupplyChain.py?rev=35978&r1=35977&r2=35978&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SupplyChain.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SupplyChain.py [utf8] Fri Jun 4 05:28:49 2010
@@ -97,16 +97,18 @@
portal_type=self.supply_link_portal_type)
# Search next link
next_node_value = current_supply_link.getNextNodeValue()
- next_supply_link_list = [x for x in supply_link_list if \
- x.getCurrentNodeValue() == next_node_value]
- # Prevent infinite loop
- if current_supply_link in next_supply_link_list:
- next_supply_link_list.remove(current_supply_link)
- # Get only production node in the list, or return the entire list
- next_production_list = [x for x in next_supply_link_list \
- if x.isProductionSupplyLink()]
+
+ next_supply_link_list = []
+ next_production_list = []
+ for supply_link in supply_link_list:
+ if supply_link != current_supply_link and \
+ supply_link.getCurrentNodeValue() == next_node_value:
+ next_supply_link_list.append(supply_link)
+ if supply_link.isProductionSupplyLink():
+ next_production_list.append(supply_link)
+
if next_production_list != []:
- next_supply_link_list = next_production_list
+ return next_production_list
return next_supply_link_list
security.declareProtected(Permissions.View,
More information about the Erp5-report
mailing list