Commit 4da01688 authored by Vincent Pelletier's avatar Vincent Pelletier

Avoid creating a PersistentMapping instance to just overwrite it at function end.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18544 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 42775c10
...@@ -191,12 +191,6 @@ class XMLMatrix(Folder): ...@@ -191,12 +191,6 @@ class XMLMatrix(Folder):
if current_range == list(kw): # kw is a tuple if current_range == list(kw): # kw is a tuple
return return
# We must make sure the base_id exists
# in the event of a matrix creation for example
if not self.index.has_key(base_id):
# Create an index for this base_id
self.index[base_id] = PersistentMapping()
# Recreate a new index for the new range defined in *kw # Recreate a new index for the new range defined in *kw
i = 0 i = 0
for index_ids in kw: for index_ids in kw:
...@@ -207,18 +201,19 @@ class XMLMatrix(Folder): ...@@ -207,18 +201,19 @@ class XMLMatrix(Folder):
j += 1 j += 1
i += 1 i += 1
# Look at each dimension i of the previous index if self.index.has_key(base_id):
for i in self.index[base_id].keys(): # Look at each dimension i of the previous index
movement[i] = {} for i in self.index[base_id].keys():
# If the new index has the same dimensionality movement[i] = {}
# Look at new location of cells # If the new index has the same dimensionality
if new_index.has_key(i): # Look at new location of cells
# Look at each index in a given dimension i if new_index.has_key(i):
for my_id in self.index[base_id][i].keys(): # Look at each index in a given dimension i
new_place = new_index[i].get(my_id) for my_id in self.index[base_id][i].keys():
old_place = self.index[base_id][i][my_id] new_place = new_index[i].get(my_id)
# create a movement in dimension i between old_place and new_place old_place = self.index[base_id][i][my_id]
movement[i][old_place] = new_place # create a movement in dimension i between old_place and 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 = []
......
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