From f3ce147eddfb54575032e64112278417d32f4fd5 Mon Sep 17 00:00:00 2001 From: schlatterbeck Date: Fri, 5 Mar 2010 14:22:34 +0000 Subject: [PATCH] - unify number searching across backends git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4470 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/backends/back_anydbm.py | 5 ++++- test/db_test_base.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 3962a63..90cf05e 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -1647,7 +1647,10 @@ class Class(hyperdb.Class): elif isinstance(propclass, hyperdb.Number): if type(v) != type([]): - v = v.split(',') + try : + v = v.split(',') + except AttributeError : + v = [v] l.append((OTHER, k, [float(val) for val in v])) filterspec = l diff --git a/test/db_test_base.py b/test/db_test_base.py index bb4272a..4f68b79 100644 --- a/test/db_test_base.py +++ b/test/db_test_base.py @@ -1123,6 +1123,8 @@ class DBTest(MyTestCase): ae(filt(None, {'age': '1.5'}, ('+','id'), (None,None)), ['4']) ae(filt(None, {'age': '2'}, ('+','id'), (None,None)), ['5']) ae(filt(None, {'age': ['1','2']}, ('+','id'), (None,None)), ['3','5']) + ae(filt(None, {'age': 2}, ('+','id'), (None,None)), ['5']) + ae(filt(None, {'age': [1,2]}, ('+','id'), (None,None)), ['3','5']) def testFilteringString(self): ae, filt = self.filteringSetup() -- 2.30.2