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):
if not self.index.has_key(base_id):
return None
cell_id_list = [base_id]
append = cell_id_list.append
index = self.index[base_id]
for i, my_id in enumerate(kw):
try:
append(str(index[i][my_id]))
except KeyError:
return None
cell_id = '_'.join(cell_id_list)
cell_id = self.keyToId(kw, base_id = base_id)
if cell_id is None:
return None
return self.get(cell_id)
security.declareProtected( Permissions.AccessContentsInformation,
......@@ -493,16 +487,10 @@ class XMLMatrix(Folder):
if not self.index.has_key(base_id):
return None
cell_id_list = [base_id]
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:
cell_id = self.keyToId(kw, base_id = base_id)
if cell_id is None:
raise KeyError, 'Invalid key: %s' % str(kw)
cell_id = "_".join(cell_id_list)
cell = self.get(cell_id)
if cell is not None:
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