Commit e68d9bde authored by Nicolas Dumazet's avatar Nicolas Dumazet

reverting r31508. Add a comment explaining why sets cant be used for a

cleaner algorithm


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31509 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9a0f030
...@@ -148,15 +148,18 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -148,15 +148,18 @@ class TradeCondition(Path, Transformation, XMLMatrix):
# it is possible, that specialised object cannot be specialised # it is possible, that specialised object cannot be specialised
# anymore # anymore
continue continue
difference = set(child_specialised_value_list).difference(\ # Use a set for faster lookups. We do not use sets everywhere
# because search order does matter
intersection = set(child_specialised_value_list).intersection(\
set(visited_trade_condition_list)) set(visited_trade_condition_list))
# don't add model that have already been visited. This permit to for model in child_specialised_value_list:
# visit all the tree and to prevent having circular dependency # don't add model that have already been visited. This permit to
for model in difference: # visit all the tree and to prevent having circular dependency
specialise_value_list.append(model) if model not in intersection:
# only add those who matches the portal type given specialise_value_list.append(model)
if model in child_visited_trade_condition_list: # only add those who matches the portal type given
visited_trade_condition_list.append(model) if model in child_visited_trade_condition_list:
visited_trade_condition_list.append(model)
return visited_trade_condition_list return visited_trade_condition_list
......
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