Commit 918ada2b authored by Julien Muchembled's avatar Julien Muchembled

BusinessProcess: use immutable to avoid useless copies

parent 9781d567
...@@ -214,9 +214,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -214,9 +214,9 @@ class BusinessProcess(Path, XMLObject):
""" """
if trade_phase is not None: if trade_phase is not None:
if isinstance(trade_phase, basestring): if isinstance(trade_phase, basestring):
trade_phase = set((trade_phase,)) trade_phase = frozenset((trade_phase,))
else: else:
trade_phase = set(trade_phase) trade_phase = frozenset(trade_phase)
kw.setdefault('portal_type', self.getPortalBusinessLinkTypeList()) kw.setdefault('portal_type', self.getPortalBusinessLinkTypeList())
kw.setdefault('sort_on', 'int_index') kw.setdefault('sort_on', 'int_index')
original_business_link_list = self.objectValues(**kw) # Why Object Values ??? XXX-JPS original_business_link_list = self.objectValues(**kw) # Why Object Values ??? XXX-JPS
...@@ -231,7 +231,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -231,7 +231,7 @@ class BusinessProcess(Path, XMLObject):
if (successor is not _marker and if (successor is not _marker and
business_link.getSuccessor() != successor): business_link.getSuccessor() != successor):
continue # Filter our business link which successor does not match continue # Filter our business link which successor does not match
if trade_phase is not None and not trade_phase.intersection( if trade_phase is not None and trade_phase.isdisjoint(
business_link.getTradePhaseList()): business_link.getTradePhaseList()):
continue # Filter our business link which trade phase does not match continue # Filter our business link which trade phase does not match
business_link_list.append(business_link) business_link_list.append(business_link)
...@@ -686,7 +686,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -686,7 +686,7 @@ class BusinessProcess(Path, XMLObject):
id_index = 0 id_index = 0
base_id = amount.getId() base_id = amount.getId()
if update_property_dict is None: update_property_dict = {} if update_property_dict is None: update_property_dict = {}
filter_trade_phase = set(trade_phase).intersection filter_trade_phase = frozenset(trade_phase).intersection
for trade_model_path in self.getTradeModelPathValueList(context=amount, trade_phase=trade_phase): for trade_model_path in self.getTradeModelPathValueList(context=amount, trade_phase=trade_phase):
id_index += 1 id_index += 1
movement = newTempSimulationMovement(trade_model_path, movement = newTempSimulationMovement(trade_model_path,
......
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