Set 'implicit_join' by default on buildSQLQuery()

Set 'implicit_join' as True by default on portal_catalog.buildSQLQuery(), but
keep it as False by default on portal_catalog.searchResults(), since much
existing code that manually craft SQL queries assumes joins to be implicit.
parent fb7a3a3c
...@@ -2294,8 +2294,11 @@ class Catalog(Folder, ...@@ -2294,8 +2294,11 @@ class Catalog(Folder,
select_dict = dict([(x, None) for x in select_dict]) select_dict = dict([(x, None) for x in select_dict])
# Handle left_join_list # Handle left_join_list
left_join_list = kw.pop('left_join_list', ()) left_join_list = kw.pop('left_join_list', ())
# Handle implicit_join # Handle implicit_join. It's True by default, as there's a lot of code
implicit_join = kw.pop('implicit_join', False) # in BT5s and elsewhere that calls buildSQLQuery() expecting implicit
# join. self._queryResults() defaults it to False for those using
# catalog.searchResults(...) or catalog(...) directly.
implicit_join = kw.pop('implicit_join', True)
# Handle order_by_list # Handle order_by_list
order_by_list = kw.pop('order_by_list', None) order_by_list = kw.pop('order_by_list', None)
sort_on = kw.pop('sort_on', None) sort_on = kw.pop('sort_on', None)
...@@ -2420,6 +2423,7 @@ class Catalog(Folder, ...@@ -2420,6 +2423,7 @@ class Catalog(Folder,
""" Returns a list of brains from a set of constraints on variables """ """ Returns a list of brains from a set of constraints on variables """
if build_sql_query_method is None: if build_sql_query_method is None:
build_sql_query_method = self.buildSQLQuery build_sql_query_method = self.buildSQLQuery
kw.setdefault('implicit_join', False)
query = build_sql_query_method(REQUEST=REQUEST, **kw) query = build_sql_query_method(REQUEST=REQUEST, **kw)
# XXX: decide if this should be made normal # XXX: decide if this should be made normal
ENFORCE_SEPARATION = True ENFORCE_SEPARATION = True
......
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