Commit ae2d6d6f authored by Nicolas Dumazet's avatar Nicolas Dumazet

a KeyError here is rare: a try..except block is better than "look before leap"


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32724 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 31089920
...@@ -496,9 +496,9 @@ class XMLMatrix(Folder): ...@@ -496,9 +496,9 @@ class XMLMatrix(Folder):
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):
if base_item[i].has_key(my_id): try:
cell_id += '_%s' % base_item[i][my_id] cell_id += '_%s' % base_item[i][my_id]
else: except KeyError:
raise KeyError, 'Invalid key: %s' % str(kw) raise KeyError, 'Invalid key: %s' % str(kw)
cell = self.get(cell_id) cell = self.get(cell_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