Commit 5a0ec5a4 authored by Vincent Pelletier's avatar Vincent Pelletier

"movement" dictionnary always contains just one key, base_id, so remove this...

"movement" dictionnary always contains just one key, base_id, so remove this useless level of nesting.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b8bb0758
...@@ -208,11 +208,9 @@ class XMLMatrix(Folder): ...@@ -208,11 +208,9 @@ class XMLMatrix(Folder):
j += 1 j += 1
i += 1 i += 1
# Create the movement dictionnary
movement[base_id]={}
# Look at each dimension i of the previous index # Look at each dimension i of the previous index
for i in self.index[base_id].keys(): for i in self.index[base_id].keys():
movement[base_id][i]={} movement[i] = {}
# If the new index has the same dimensionality # If the new index has the same dimensionality
# Look at new location of cells # Look at new location of cells
if new_index[base_id].has_key(i): if new_index[base_id].has_key(i):
...@@ -221,7 +219,7 @@ class XMLMatrix(Folder): ...@@ -221,7 +219,7 @@ class XMLMatrix(Folder):
new_place = new_index[base_id][i].get(my_id) new_place = new_index[base_id][i].get(my_id)
old_place = self.index[base_id][i][my_id] old_place = self.index[base_id][i][my_id]
# create a movement in dimension i between old_place and new_place # create a movement in dimension i between old_place and new_place
movement[base_id][i][old_place] = new_place movement[i][old_place] = new_place
# Rename every 'object_id' by 'temp_object_id' # Rename every 'object_id' by 'temp_object_id'
object_id_list = [] object_id_list = []
...@@ -262,11 +260,11 @@ class XMLMatrix(Folder): ...@@ -262,11 +260,11 @@ class XMLMatrix(Folder):
# We are looking inside the movement dictionnary where # We are looking inside the movement dictionnary where
# we should move the object, so for example # we should move the object, so for example
# 'qantity_2_5' is renamed as 'quantity_4_3' # 'qantity_2_5' is renamed as 'quantity_4_3'
if movement[base_id].has_key(i): if movement.has_key(i):
if movement[base_id][i].has_key(old_place): if movement[i].has_key(old_place):
# Replace the place of the cell only if there where a change # Replace the place of the cell only if there where a change
if (movement[base_id][i][old_place]) != None: if (movement[i][old_place]) != None:
object_place[i] = str(movement[base_id][i][old_place]) object_place[i] = str(movement[i][old_place])
to_delete = 0 to_delete = 0
else: else:
object_place[i] = None object_place[i] = None
...@@ -274,7 +272,7 @@ class XMLMatrix(Folder): ...@@ -274,7 +272,7 @@ class XMLMatrix(Folder):
# XXX In this case, we delete every cell wich are not in the # XXX In this case, we delete every cell wich are not in the
# movement dictionnary, may be this is very bad, so may be # movement dictionnary, may be this is very bad, so may be
# we need to add an extra check here, ie if # we need to add an extra check here, ie if
# if movement[base_id][i].has_key(old_place) returns None, # if movement[i].has_key(old_place) returns None,
# We may want to keep the cell, but only if we are sure # We may want to keep the cell, but only if we are sure
# the movement dictionnary will not define a new cell with this id # the movement dictionnary will not define a new cell with this id
......
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