Commit 331f1c61 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Eteri

ZSQLCatalog: Use symbolic constant instead of duplicating its value

Also, fix a logging context name.
parent 1214618f
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
import warnings import warnings
from Products.ZSQLCatalog.SQLExpression import SQLExpression from Products.ZSQLCatalog.SQLExpression import SQLExpression
from Products.ZSQLCatalog.ColumnMap import ColumnMap from Products.ZSQLCatalog.ColumnMap import ColumnMap
from zLOG import LOG from zLOG import LOG, WARNING
from Products.ZSQLCatalog.interfaces.entire_query import IEntireQuery from Products.ZSQLCatalog.interfaces.entire_query import IEntireQuery
from zope.interface.verify import verifyClass from zope.interface.verify import verifyClass
from zope.interface import implements from zope.interface import implements
...@@ -130,7 +130,7 @@ class EntireQuery(object): ...@@ -130,7 +130,7 @@ class EntireQuery(object):
try: try:
append(column_map.asSQLColumn(column)) append(column_map.asSQLColumn(column))
except KeyError: except KeyError:
LOG('EntireQuery', 100, 'Group-by column %r could not be mapped, but is passed through. This use is strongly discouraged.' % (column, )) LOG('EntireQuery', WARNING, 'Group-by column %r could not be mapped, but is passed through. This use is strongly discouraged.' % (column, ))
append(column) append(column)
self.group_by_list = new_column_list self.group_by_list = new_column_list
# Build a dictionnary from select_dict aliasing their mapped representations # Build a dictionnary from select_dict aliasing their mapped representations
...@@ -147,7 +147,7 @@ class EntireQuery(object): ...@@ -147,7 +147,7 @@ class EntireQuery(object):
try: try:
rendered = column_map.asSQLColumn(column) rendered = column_map.asSQLColumn(column)
except KeyError: except KeyError:
LOG('EntireQuery', 100, 'Select column %r could not be mapped, but is passed through. This use is strongly discouraged.' % (column, )) LOG('EntireQuery', WARNING, 'Select column %r could not be mapped, but is passed through. This use is strongly discouraged.' % (column, ))
rendered = column rendered = column
select_dict[alias] = rendered select_dict[alias] = rendered
# Replace given order_by_list entries by their mapped representations. # Replace given order_by_list entries by their mapped representations.
...@@ -156,13 +156,13 @@ class EntireQuery(object): ...@@ -156,13 +156,13 @@ class EntireQuery(object):
for order_by in self.order_by_list: for order_by in self.order_by_list:
column = order_by[0] column = order_by[0]
if column in self.order_by_override_set: if column in self.order_by_override_set:
LOG('EntireQuery', 100, 'Order-by column %r is forcibly accepted. This use is strongly discouraged.' % (column, )) LOG('EntireQuery', WARNING, 'Order-by column %r is forcibly accepted. This use is strongly discouraged.' % (column, ))
rendered = column rendered = column
else: else:
try: try:
rendered = column_map.asSQLColumn(column) rendered = column_map.asSQLColumn(column)
except KeyError: except KeyError:
LOG('SQLCatalog', 100, 'Order by %r ignored: it could not be mapped to a known column.' % (order_by, )) LOG('EntireQuery', WARNING, 'Order by %r ignored: it could not be mapped to a known column.' % (order_by, ))
rendered = None rendered = None
if rendered is not None: if rendered is not None:
append((rendered, ) + tuple(order_by[1:]) + ( append((rendered, ) + tuple(order_by[1:]) + (
......
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