Commit 7c5a6f28 authored by Tatuya Kamada's avatar Tatuya Kamada

Ignoring None value not to make a query.

This fix makes search dialogs work even if datetime field is included.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27722 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81caf7f3
...@@ -2023,6 +2023,7 @@ class Catalog(Folder, ...@@ -2023,6 +2023,7 @@ class Catalog(Folder,
value = dict(value) value = dict(value)
if ignore_empty_string and ( if ignore_empty_string and (
value == '' value == ''
or value is None
or (isinstance(value, (list, tuple)) and len(value) == 0) or (isinstance(value, (list, tuple)) and len(value) == 0)
or (isinstance(value, dict) and ( or (isinstance(value, dict) and (
'query' not in value 'query' not in value
......
...@@ -277,7 +277,9 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -277,7 +277,9 @@ class TestSQLCatalog(unittest.TestCase):
ReferenceQuery(operator='<', date=DateTime('2008/02/02 10:10:11 UTC')) ReferenceQuery(operator='<', date=DateTime('2008/02/02 10:10:11 UTC'))
, operator='and'), operator='and'), , operator='and'), operator='and'),
{column: '2008/02/02 10:10:10 UTC'}) {column: '2008/02/02 10:10:10 UTC'})
self.catalog(ReferenceQuery(operator='and', date=None),
{column: None})
def test_DateTimeKey(self): def test_DateTimeKey(self):
self._testDateTimeKey('date') self._testDateTimeKey('date')
......
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