diff roundup/backends/rdbms_common.py @ 4365:667c818f6a22

- unify bool searching (filter method) across backends
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Fri, 05 Mar 2010 15:51:11 +0000
parents b9abbdd15259
children de00a238a9ad
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Fri Mar 05 14:22:34 2010 +0000
+++ b/roundup/backends/rdbms_common.py	Fri Mar 05 15:51:11 2010 +0000
@@ -2330,6 +2330,24 @@
                             pass
                 if p.sort_type > 0:
                     oc = ac = '_%s.__%s_int__'%(pln,k)
+            elif isinstance(propclass, Boolean) and p.sort_type < 2:
+                if type(v) == type(""):
+                    v = v.split(',')
+                if type(v) != type([]):
+                    v = [v]
+                bv = []
+                for val in v:
+                    if type(val) is type(''):
+                        bv.append(propclass.from_raw (val))
+                    else:
+                        bv.append(bool(val))
+                if len(bv) == 1:
+                    where.append('_%s._%s=%s'%(pln, k, a))
+                    args = args + bv
+                else:
+                    s = ','.join([a for x in v])
+                    where.append('_%s._%s in (%s)'%(pln, k, s))
+                    args = args + bv
             elif p.sort_type < 2:
                 if isinstance(v, type([])):
                     s = ','.join([a for x in v])

Roundup Issue Tracker: http://roundup-tracker.org/