Commit 0267e440 authored by Vincent Pelletier's avatar Vincent Pelletier

ZSQLCatalog.SQLCatalog: Add support for scriptable keys in getColumnSearchKey.

parent 3f079e49
...@@ -1819,7 +1819,9 @@ class Catalog(Folder, ...@@ -1819,7 +1819,9 @@ class Catalog(Folder,
If both a related key and a real column are found, the related key If both a related key and a real column are found, the related key
is used. is used.
""" """
# Is key a related key or a "real" column ? # Is key a scriptable key, a related key or a "real" column ?
script = self.getScriptableKeyScript(key)
if script is None:
related_key_definition = self.getRelatedKeyDefinition(key) related_key_definition = self.getRelatedKeyDefinition(key)
if related_key_definition is None: if related_key_definition is None:
if key in self.getColumnMap(): if key in self.getColumnMap():
...@@ -1828,6 +1830,9 @@ class Catalog(Folder, ...@@ -1828,6 +1830,9 @@ class Catalog(Folder,
search_key = None search_key = None
else: else:
search_key = self.getSearchKey(key, 'RelatedKey') search_key = self.getSearchKey(key, 'RelatedKey')
else:
search_key = SearchKeyWrapperForScriptableKey(key, script)
related_key_definition = None
return search_key, related_key_definition return search_key, related_key_definition
security.declarePrivate('hasColumn') security.declarePrivate('hasColumn')
...@@ -1960,12 +1965,7 @@ class Catalog(Folder, ...@@ -1960,12 +1965,7 @@ class Catalog(Folder,
""" """
Determine the SearchKey to use to generate a Query, and call buildQueryFromSearchKey with it. Determine the SearchKey to use to generate a Query, and call buildQueryFromSearchKey with it.
""" """
script = self.getScriptableKeyScript(key)
if script is None:
search_key, related_key_definition = self.getColumnSearchKey(key, search_key_name) search_key, related_key_definition = self.getColumnSearchKey(key, search_key_name)
else:
search_key = SearchKeyWrapperForScriptableKey(key, script)
related_key_definition = None
if search_key is None: if search_key is None:
message = 'Unknown column ' + repr(key) message = 'Unknown column ' + repr(key)
if not ignore_unknown_columns: if not ignore_unknown_columns:
......
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