Commit 2214c90d authored by Vincent Pelletier's avatar Vincent Pelletier

Reduce the verbosity of empty-value-related log messages, by displaying all...

Reduce the verbosity of empty-value-related log messages, by displaying all discarded columns at once instead of once per discarded column.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26566 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68ecf587
...@@ -1998,6 +1998,9 @@ class Catalog(Folder, ...@@ -1998,6 +1998,9 @@ class Catalog(Folder,
# column names with empty values. This is for backward compatibility. See # column names with empty values. This is for backward compatibility. See
# comment about empty values. # comment about empty values.
implicit_table_list = [] implicit_table_list = []
# empty_value_dict: contains all keys whose value causes them to be
# discarded.
empty_value_dict = {}
for key, value in kw.iteritems(): for key, value in kw.iteritems():
result = None result = None
if isinstance(value, dict_type_list): if isinstance(value, dict_type_list):
...@@ -2019,7 +2022,7 @@ class Catalog(Folder, ...@@ -2019,7 +2022,7 @@ class Catalog(Folder,
# resulting where-expression) # resulting where-expression)
if '.' in key: if '.' in key:
implicit_table_list.append(key) implicit_table_list.append(key)
LOG('SQLCatalog', WARNING, 'Discarding empty value for key %r: %r' % (key, value)) empty_value_dict[key] = value
else: else:
script = self.getScriptableKeyScript(key) script = self.getScriptableKeyScript(key)
if isinstance(value, _Query): if isinstance(value, _Query):
...@@ -2057,6 +2060,8 @@ class Catalog(Folder, ...@@ -2057,6 +2060,8 @@ class Catalog(Folder,
unknown_column_dict[key] = value unknown_column_dict[key] = value
else: else:
append(result) append(result)
if len(empty_value_dict):
LOG('SQLCatalog', WARNING, 'Discarding columns with empty values: %r' % (empty_value_dict, ))
if len(unknown_column_dict): if len(unknown_column_dict):
LOG('SQLCatalog', WARNING, 'Unknown columns %r, skipped.' % (unknown_column_dict.keys(), )) LOG('SQLCatalog', WARNING, 'Unknown columns %r, skipped.' % (unknown_column_dict.keys(), ))
return ComplexQuery(query_list, logical_operator=operator, unknown_column_dict=unknown_column_dict, implicit_table_list=implicit_table_list) return ComplexQuery(query_list, logical_operator=operator, unknown_column_dict=unknown_column_dict, implicit_table_list=implicit_table_list)
......
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