Commit 1e0d3a7a authored by Nicolas Dumazet's avatar Nicolas Dumazet

cleanups

* use bool instead of int
* remove "is_bool == 1" tests
* unindent if possible


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35975 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c0caabc7
...@@ -220,14 +220,16 @@ class SupplyChain(Path, XMLObject): ...@@ -220,14 +220,16 @@ class SupplyChain(Path, XMLObject):
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
'getPreviousPackingListSupplyLinkList') 'getPreviousPackingListSupplyLinkList')
def getPreviousPackingListSupplyLinkList(self, current_supply_link, def getPreviousPackingListSupplyLinkList(self, current_supply_link,
recursive=0, all=0, recursive=False, all=False,
checked_link_list=None, checked_link_list=None,
movement=None): movement=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.
""" """
# XXX document "all" parameter
# Initialize checked_link_list parameter... # Initialize checked_link_list parameter...
if checked_link_list is None: if checked_link_list is None:
checked_link_list = [] checked_link_list = []
...@@ -236,7 +238,7 @@ class SupplyChain(Path, XMLObject): ...@@ -236,7 +238,7 @@ class SupplyChain(Path, XMLObject):
if current_supply_link in checked_link_list: if current_supply_link in checked_link_list:
raise SupplyChainError,\ raise SupplyChainError,\
"SupplyLink %r is in a loop." % current_supply_link "SupplyLink %r is in a loop." % current_supply_link
else:
packing_list_link_list = [] packing_list_link_list = []
checked_link_list.append(current_supply_link) checked_link_list.append(current_supply_link)
# Get the previous link list # Get the previous link list
...@@ -251,7 +253,7 @@ class SupplyChain(Path, XMLObject): ...@@ -251,7 +253,7 @@ class SupplyChain(Path, XMLObject):
(previous_link.test(movement, concurrent_list)): (previous_link.test(movement, concurrent_list)):
packing_list_link_list.append(previous_link) packing_list_link_list.append(previous_link)
# Browse the previous link # Browse the previous link
if (recursive==1): if recursive:
packing_list_link_list.extend( packing_list_link_list.extend(
self.getPreviousPackingListSupplyLinkList( self.getPreviousPackingListSupplyLinkList(
previous_link, previous_link,
...@@ -261,7 +263,7 @@ class SupplyChain(Path, XMLObject): ...@@ -261,7 +263,7 @@ class SupplyChain(Path, XMLObject):
return packing_list_link_list return packing_list_link_list
def getPreviousIndustrialPhaseList(self, current_supply_link, method_id, def getPreviousIndustrialPhaseList(self, current_supply_link, method_id,
include_current=0, all=0): include_current=False, all=False):
""" """
Return recursively all previous industrial phase. Return recursively all previous industrial phase.
""" """
...@@ -269,7 +271,7 @@ class SupplyChain(Path, XMLObject): ...@@ -269,7 +271,7 @@ class SupplyChain(Path, XMLObject):
previous_supply_link_list = method(current_supply_link, recursive=1, previous_supply_link_list = method(current_supply_link, recursive=1,
all=all) all=all)
# Add the current industrial phase # Add the current industrial phase
if (include_current == 1): if include_current:
previous_supply_link_list.append(current_supply_link) previous_supply_link_list.append(current_supply_link)
# Generate the industrial phase list, and remove double # Generate the industrial phase list, and remove double
ind_phase_dict = {} ind_phase_dict = {}
...@@ -285,7 +287,7 @@ class SupplyChain(Path, XMLObject): ...@@ -285,7 +287,7 @@ class SupplyChain(Path, XMLObject):
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
'getPreviousProductionIndustrialPhaseList') 'getPreviousProductionIndustrialPhaseList')
def getPreviousProductionIndustrialPhaseList(self, current_supply_link, def getPreviousProductionIndustrialPhaseList(self, current_supply_link,
all=0): all=False):
""" """
Return recursively all previous industrial phase representing Return recursively all previous industrial phase representing
a production. a production.
...@@ -305,7 +307,7 @@ class SupplyChain(Path, XMLObject): ...@@ -305,7 +307,7 @@ class SupplyChain(Path, XMLObject):
return self.getPreviousIndustrialPhaseList( return self.getPreviousIndustrialPhaseList(
current_supply_link, current_supply_link,
"getPreviousPackingListSupplyLinkList", "getPreviousPackingListSupplyLinkList",
include_current=1) include_current=True)
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
'test') 'test')
......
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