Code

- unify number searching across backends
authorschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 5 Mar 2010 14:22:34 +0000 (14:22 +0000)
committerschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 5 Mar 2010 14:22:34 +0000 (14:22 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4470 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/back_anydbm.py
test/db_test_base.py

index 3962a637f3429b4e5dfa485f9b9348cddce23ab4..90cf05e461f17b9a0cb2268e97e08b9749f9e026 100644 (file)
@@ -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
index bb4272ab75a4c0ad6b3593d024d716b93d54bfc7..4f68b79a66f9bc7e6023236ce2bc720946d4e03c 100644 (file)
@@ -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()