Commit a21cb623 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Use a set instead of a list for child_visited_trade_condition

child_visited_trade_condition_list is only used for lookups, it's faster to
rely on a set


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31510 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e68d9bde
...@@ -142,8 +142,8 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -142,8 +142,8 @@ class TradeCondition(Path, Transformation, XMLMatrix):
# all children # all children
child_specialised_value_list = specialise.getSpecialiseValueList() child_specialised_value_list = specialise.getSpecialiseValueList()
# only children that match the portal_type given # only children that match the portal_type given
child_visited_trade_condition_list = specialise.getSpecialiseValueList(\ child_visited_trade_condition_set = set(specialise.\
portal_type=portal_type_list) getSpecialiseValueList(portal_type=portal_type_list))
except AttributeError: except AttributeError:
# it is possible, that specialised object cannot be specialised # it is possible, that specialised object cannot be specialised
# anymore # anymore
...@@ -158,7 +158,7 @@ class TradeCondition(Path, Transformation, XMLMatrix): ...@@ -158,7 +158,7 @@ class TradeCondition(Path, Transformation, XMLMatrix):
if model not in intersection: if model not in intersection:
specialise_value_list.append(model) specialise_value_list.append(model)
# only add those who matches the portal type given # only add those who matches the portal type given
if model in child_visited_trade_condition_list: if model in child_visited_trade_condition_set:
visited_trade_condition_list.append(model) 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