Commit 2ad70624 authored by Nicolas Dumazet's avatar Nicolas Dumazet

use keyToId instead of re-inventing the wheel =)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32729 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e5ffd51
...@@ -75,15 +75,9 @@ class XMLMatrix(Folder): ...@@ -75,15 +75,9 @@ class XMLMatrix(Folder):
if not self.index.has_key(base_id): if not self.index.has_key(base_id):
return None return None
cell_id_list = [base_id] cell_id = self.keyToId(kw, base_id = base_id)
append = cell_id_list.append if cell_id is None:
index = self.index[base_id]
for i, my_id in enumerate(kw):
try:
append(str(index[i][my_id]))
except KeyError:
return None return None
cell_id = '_'.join(cell_id_list)
return self.get(cell_id) return self.get(cell_id)
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
...@@ -493,16 +487,10 @@ class XMLMatrix(Folder): ...@@ -493,16 +487,10 @@ class XMLMatrix(Folder):
if not self.index.has_key(base_id): if not self.index.has_key(base_id):
return None return None
cell_id_list = [base_id] cell_id = self.keyToId(kw, base_id = base_id)
if cell_id is None:
base_item = self.index[base_id]
try:
cell_id_list.extend(base_item[i][my_id] for i, my_id in enumerate(kw))
except KeyError:
raise KeyError, 'Invalid key: %s' % str(kw) raise KeyError, 'Invalid key: %s' % str(kw)
cell_id = "_".join(cell_id_list)
cell = self.get(cell_id) cell = self.get(cell_id)
if cell is not None: if cell is not None:
return cell return cell
......
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