Commit ba8bd8b1 authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Yusei Tahara

ZSQLCatalog.SQLCatalog: Ignore unknown columns in getParams() instead (c6d26af5).

Selection.__call__() calls getParams() and as getParams() can be called
directly from many places (such as SelectionTool.getSelectionParamsFor()),
it makes more sense to have it here.
parent bda506f9
...@@ -207,10 +207,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -207,10 +207,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
#LOG("Selection", 0, str(method)) #LOG("Selection", 0, str(method))
#LOG('Selection', 0, "self.invert_mode = %s" % repr(self.invert_mode)) #LOG('Selection', 0, "self.invert_mode = %s" % repr(self.invert_mode))
if not params: if not params:
kw = self.params.copy() kw = self.getParams()
else: else:
kw = params.copy() kw = params.copy()
kw.setdefault("ignore_unknown_columns", True) kw.setdefault("ignore_unknown_columns", True)
# Always remove '-C'-named parameter. # Always remove '-C'-named parameter.
kw.pop('-C', None) kw.pop('-C', None)
if self.invert_mode is not 0: if self.invert_mode is not 0:
...@@ -280,7 +280,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -280,7 +280,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
""" """
if not isinstance(self.params, dict): if not isinstance(self.params, dict):
self.params = {} self.params = {}
return self.params.copy()
params = self.params.copy()
params.setdefault("ignore_unknown_columns", True)
return params
security.declarePublic('getSortOrder') security.declarePublic('getSortOrder')
def getSortOrder(self): def getSortOrder(self):
......
...@@ -74,7 +74,7 @@ class TestSelectionTool(ERP5TypeTestCase): ...@@ -74,7 +74,7 @@ class TestSelectionTool(ERP5TypeTestCase):
self.assertEqual('test_selection', selection.name) self.assertEqual('test_selection', selection.name)
def testGetSelectionParamsFor(self): def testGetSelectionParamsFor(self):
self.assertEqual({'key':'value'}, self.assertEqual({'key':'value', 'ignore_unknown_columns': True},
self.portal_selections.getSelectionParamsFor('test_selection')) self.portal_selections.getSelectionParamsFor('test_selection'))
def testGetSelectionParamsDictInterface(self): def testGetSelectionParamsDictInterface(self):
......
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