Commit 2786c72b authored by Vincent Pelletier's avatar Vincent Pelletier

When query_table is given a false value, do not expand related keys.

  Also, since columns are not mapped to any table when query_table is set to a false value, this means that catalog passes column names through. The purppose of using catalog over rendering "by hand" the where-expression is that it will use search keys (keyword key, fulltext key, ...) to guess desired operator.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25060 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 860bb280
...@@ -1924,9 +1924,10 @@ class Catalog(Folder, ...@@ -1924,9 +1924,10 @@ class Catalog(Folder,
kw[key] = REQUEST[key] kw[key] = REQUEST[key]
def getNewKeyAndUpdateVariables(key): def getNewKeyAndUpdateVariables(key):
new_key = None
if query_table:
key_is_acceptable = key in acceptable_key_map # Only calculate once key_is_acceptable = key in acceptable_key_map # Only calculate once
key_is_related = key in related_keys key_is_related = key in related_keys
new_key = None
if key_is_acceptable or key_is_related: if key_is_acceptable or key_is_related:
if key_is_related: # relation system has priority (ex. security_uid) if key_is_related: # relation system has priority (ex. security_uid)
# We must rename the key # We must rename the key
...@@ -1943,8 +1944,7 @@ class Catalog(Folder, ...@@ -1943,8 +1944,7 @@ class Catalog(Folder,
if len(acceptable_key_map[key]) == 1 : if len(acceptable_key_map[key]) == 1 :
new_key = '%s.%s' % (acceptable_key_map[key][0], key) new_key = '%s.%s' % (acceptable_key_map[key][0], key)
# query_table specifies what table name should be used by default # query_table specifies what table name should be used by default
elif query_table and \ elif '%s.%s' % (query_table, key) in acceptable_key_map:
'%s.%s' % (query_table, key) in acceptable_key_map:
new_key = '%s.%s' % (query_table, key) new_key = '%s.%s' % (query_table, key)
elif key == 'uid': elif key == 'uid':
# uid is always ambiguous so we can only change it here # uid is always ambiguous so we can only change it here
...@@ -1956,6 +1956,8 @@ class Catalog(Folder, ...@@ -1956,6 +1956,8 @@ class Catalog(Folder,
if new_key is not None: if new_key is not None:
# Add table to table dict, we use catalog by default # Add table to table dict, we use catalog by default
from_table_dict[acceptable_key_map[new_key][0]] = acceptable_key_map[new_key][0] from_table_dict[acceptable_key_map[new_key][0]] = acceptable_key_map[new_key][0]
else:
new_key = key
key_alias_dict[key] = new_key key_alias_dict[key] = new_key
return new_key return new_key
......
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