From 57254bdce15de118c7b87ca5e910607a36f52eaa Mon Sep 17 00:00:00 2001 From: Nicolas Dumazet <nicolas.dumazet@nexedi.com> Date: Thu, 18 Feb 2010 10:43:12 +0000 Subject: [PATCH] simplify control flow git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32753 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/XMLMatrix.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/product/ERP5Type/XMLMatrix.py b/product/ERP5Type/XMLMatrix.py index 10f02f1996..f179c31b96 100644 --- a/product/ERP5Type/XMLMatrix.py +++ b/product/ERP5Type/XMLMatrix.py @@ -656,19 +656,17 @@ class XMLMatrix(Folder): object_id_split = object_id.split('_') # We try to find the first split id which is an int base_id_len = len(object_id_split) - test_num = None + base_id = None while base_id_len > 0: try: # 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]) except ValueError: + base_id = '_'.join(object_id_split[:base_id_len]) break base_id_len -= 1 - if base_id_len > 0: - base_id = '_'.join(object_id_split[0:base_id_len]) - else: - test_num = None - if test_num is not None: + + if base_id is not None: if not self.index.has_key(base_id): # The matrix does not have this base_id addError("There is no index for base_id %s" % base_id) -- 2.30.9