From 0c4f86f470ae870af550ac9ba9aeeddc306402f4 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Mon, 8 Nov 2010 09:05:19 +0000 Subject: [PATCH] If both a related key and a real column are found in getColumnSearchKey(), now the related key is used, because adding a related key with the same name should be done by the explicit intention to override the behaviour. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40012 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/SQLCatalog.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index 549a0cba63..2178437d17 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -1951,20 +1951,19 @@ class Catalog(Folder, Also return a related key definition string with following rules: - If returned SearchKey is a RelatedKey, value is its definition - Otherwise, value is None + + If both a related key and a real column are found, the related key + is used. """ - # Is key a "real" column or some related key ? - related_key_definition = None - if key in self.getColumnMap(): - search_key = self.getSearchKey(key, search_key_name) - else: - # Maybe a related key... - related_key_definition = self.getRelatedKeyDefinition(key) - if related_key_definition is None: - # Unknown - search_key = None + # Is key a related key or a "real" column ? + related_key_definition = self.getRelatedKeyDefinition(key) + if related_key_definition is None: + if key in self.getColumnMap(): + search_key = self.getSearchKey(key, search_key_name) else: - # It's a related key - search_key = self.getSearchKey(key, 'RelatedKey') + search_key = None + else: + search_key = self.getSearchKey(key, 'RelatedKey') return search_key, related_key_definition def hasColumn(self, column): -- 2.30.9