From eacc15fab8b96c966c6f6b82ed8563d1f3e67f8b Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <legac@cppm.in2p3.fr> Date: Mon, 25 Mar 2013 16:51:45 +0100 Subject: [PATCH] Fix a bug in the improved version of get_foreign_field. --- modules/plugin_dbui/helper.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py index d3629c78..c9c16315 100644 --- a/modules/plugin_dbui/helper.py +++ b/modules/plugin_dbui/helper.py @@ -242,16 +242,14 @@ def get_foreign_field(field): # IS_IN_DB is not use. # The parent key for the left join is the id key of the parent table # the parent field is the first field of the parent table which differs id - if not validators: - i = field.type.index(' ') - ktablename = field.type[i:].strip() - - for kfield in field._db[ktablename]: - if kfield.name != 'id': - return (ktablename, kfield.name, 'id') - + i = field.type.index(' ') + ktablename = field.type[i:].strip() + + for kfield in field._db[ktablename]: + if kfield.name != 'id': + return (ktablename, kfield.name, 'id') - return None + raise Exception def get_id(table, **kwargs): -- GitLab