Commit 4bf9bd74 authored by Nicolas Dumazet's avatar Nicolas Dumazet

simplify control flow


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32749 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8bc725a3
...@@ -656,15 +656,13 @@ class XMLMatrix(Folder): ...@@ -656,15 +656,13 @@ class XMLMatrix(Folder):
object_id_split = object_id.split('_') object_id_split = object_id.split('_')
# We try to find the first split id which is an int # We try to find the first split id which is an int
base_id_len = len(object_id_split) base_id_len = len(object_id_split)
is_int = 1
test_num = None test_num = None
while base_id_len > 0: while base_id_len > 0:
try: try:
# if this succeeds, it is very likely a cell with an id such as quantity_X_Y_0_Z # if this succeeds, it is very likely a cell with an id such as quantity_X_Y_0_Z
test_num = int(object_id_split[base_id_len-1]) test_num = int(object_id_split[base_id_len-1])
except ValueError: except ValueError:
is_int = 0 break
if not is_int: break
base_id_len -= 1 base_id_len -= 1
if base_id_len > 0: if base_id_len > 0:
base_id = '_'.join(object_id_split[0:base_id_len]) base_id = '_'.join(object_id_split[0:base_id_len])
......
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