Commit e556ab75 authored by Yoshinori Okuji's avatar Yoshinori Okuji

More cleanup.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38185 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3c8a1cf3
...@@ -283,9 +283,9 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -283,9 +283,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
divergence_list): divergence_list):
instance = None instance = None
property_dict = {} property_dict = {}
if not len(instance_list): if not instance_list:
for movement_group_node in movement_group_node_list: for movement_group_node in movement_group_node_list:
for k,v in movement_group_node.getGroupEditDict().iteritems(): for k, v in movement_group_node.getGroupEditDict().iteritems():
if k in property_dict: if k in property_dict:
raise DuplicatedPropertyDictKeysError(k) raise DuplicatedPropertyDictKeysError(k)
else: else:
...@@ -297,8 +297,12 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -297,8 +297,12 @@ class OrderBuilder(XMLObject, Amount, Predicate):
current = movement_group_node_list[-1].getMovementList()[0].getDeliveryValue() current = movement_group_node_list[-1].getMovementList()[0].getDeliveryValue()
portal = self.getPortalObject() portal = self.getPortalObject()
while current != portal: while current != portal:
if current in instance_list: try:
instance_list.sort(key=lambda x: x != current and 1 or 0) instance_list.remove(current)
except ValueError:
pass
else:
instance_list.insert(0, current)
break break
current = current.getParentValue() current = current.getParentValue()
except AttributeError: except AttributeError:
...@@ -306,7 +310,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -306,7 +310,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
for instance_to_update in instance_list: for instance_to_update in instance_list:
result, property_dict = self._test( result, property_dict = self._test(
instance_to_update, movement_group_node_list, divergence_list) instance_to_update, movement_group_node_list, divergence_list)
if result == True: if result:
instance = instance_to_update instance = instance_to_update
break break
return instance, property_dict return instance, property_dict
......
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