Commit dfb4a06b authored by Nicolas Dumazet's avatar Nicolas Dumazet

"_".join(item_list) is faster and more pythonic than several str += "_%" % item


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32725 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ae2d6d6f
...@@ -490,17 +490,20 @@ class XMLMatrix(Folder): ...@@ -490,17 +490,20 @@ class XMLMatrix(Folder):
if getattr(aq_base(self), 'index', None) is None: if getattr(aq_base(self), 'index', None) is None:
return None return None
base_id = kwd.get('base_id', "cell") base_id = kwd.get('base_id', "cell")
cell_id = base_id if not self.index.has_key(base_id):
if not self.index.has_key(cell_id):
return None return None
cell_id_list = [base_id]
base_item = self.index[base_id] base_item = self.index[base_id]
for i, my_id in enumerate(kw): for i, my_id in enumerate(kw):
try: try:
cell_id += '_%s' % base_item[i][my_id] cell_id_list.append(base_item[i][my_id])
except KeyError: 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