Mercurial > p > roundup > code
diff roundup/backends/back_anydbm.py @ 2453:0e2a0c2c8142
allow list of values for id, Number and Boolean filtering in anydbm backend
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 13 Jun 2004 01:05:46 +0000 |
| parents | c45ed2413044 |
| children | d7488e349a03 |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Sun Jun 13 00:27:45 2004 +0000 +++ b/roundup/backends/back_anydbm.py Sun Jun 13 01:05:46 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.154 2004-06-13 00:27:45 richard Exp $ +#$Id: back_anydbm.py,v 1.155 2004-06-13 01:05:46 richard Exp $ '''This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several @@ -1654,15 +1654,26 @@ pass elif isinstance(propclass, Boolean): - if type(v) is type(''): - bv = v.lower() in ('yes', 'true', 'on', '1') - else: - bv = v + if type(v) != type([]): + v = v.split(',') + bv = [] + for val in v: + if type(val) is type(''): + bv.append(val.lower() in ('yes', 'true', 'on', '1')) + else: + bv.append(val) l.append((OTHER, k, bv)) + + elif k == 'id': + if type(v) != type([]): + v = v.split(',') + l.append((OTHER, k, [str(int(val)) for val in v])) + elif isinstance(propclass, Number): - l.append((OTHER, k, float(v))) - else: - l.append((OTHER, k, v)) + if type(v) != type([]): + v = v.split(',') + l.append((OTHER, k, [float(val) for val in v])) + filterspec = l # now, find all the nodes that are active and pass filtering @@ -1678,7 +1689,7 @@ # apply filter for t, k, v in filterspec: # handle the id prop - if k == 'id' and v == nodeid: + if k == 'id' and nodeid in v: continue # make sure the node has the property @@ -1726,7 +1737,7 @@ break elif t == OTHER: # straight value comparison for the other types - if node[k] != v: + if node[k] not in v: break else: matches.append([nodeid, node])
