Commit 2d335c7d authored by Nicolas Dumazet's avatar Nicolas Dumazet

if bool == 1 kind of test never really help


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35971 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ecf74854
...@@ -166,11 +166,11 @@ class SupplyChain(Path, XMLObject): ...@@ -166,11 +166,11 @@ class SupplyChain(Path, XMLObject):
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
'getPreviousProductionSupplyLinkList') 'getPreviousProductionSupplyLinkList')
def getPreviousProductionSupplyLinkList(self, current_supply_link, def getPreviousProductionSupplyLinkList(self, current_supply_link,
recursive=0, all=0, recursive=False, all=False,
checked_link_list=None): checked_link_list=None):
""" """
Return the previous SupplyLink which represents a production. Return the previous SupplyLink which represents a production.
If recursive=1, browse the SupplyChain until a valid link is found. If recursive, browse the SupplyChain until a valid link is found.
checked_link_list is used to prevent infinite loop. checked_link_list is used to prevent infinite loop.
""" """
# Initialize checked_link_list parameter... # Initialize checked_link_list parameter...
...@@ -188,7 +188,7 @@ class SupplyChain(Path, XMLObject): ...@@ -188,7 +188,7 @@ class SupplyChain(Path, XMLObject):
previous_link_list = self.getPreviousSupplyLinkList(current_supply_link) previous_link_list = self.getPreviousSupplyLinkList(current_supply_link)
# Test each link # Test each link
for previous_link in previous_link_list: for previous_link in previous_link_list:
continue_recursivity = 0 continue_recursivity = False
# Great, we find a valid one # Great, we find a valid one
if previous_link.isProductionSupplyLink(): if previous_link.isProductionSupplyLink():
transformation_link_list.append(previous_link) transformation_link_list.append(previous_link)
...@@ -200,13 +200,13 @@ class SupplyChain(Path, XMLObject): ...@@ -200,13 +200,13 @@ class SupplyChain(Path, XMLObject):
"Those SupplyLinks are in conflict: %r and %r" %\ "Those SupplyLinks are in conflict: %r and %r" %\
(current_supply_link.getRelativeUrl(),\ (current_supply_link.getRelativeUrl(),\
previous_link.getRelativeUrl()) previous_link.getRelativeUrl())
if all == 1: if all:
continue_recursivity=1 continue_recursivity = True
# Reject the current # Reject the current
elif (recursive==1): elif recursive:
continue_recursivity=1 continue_recursivity = True
# Continue to browse the chain ? # Continue to browse the chain ?
if continue_recursivity == 1: if continue_recursivity:
# Browse the previous link # Browse the previous link
transformation_link_list.extend( transformation_link_list.extend(
self.getPreviousProductionSupplyLinkList( self.getPreviousProductionSupplyLinkList(
......
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