1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- #$Id: back_anydbm.py,v 1.146.2.8 2004-06-13 00:40:55 richard Exp $
18+ #$Id: back_anydbm.py,v 1.146.2.9 2004-06-13 01:11:23 richard Exp $
1919'''This module defines a backend that saves the hyperdatabase in a
2020database chosen by anydbm. It is guaranteed to always be available in python
2121versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -1654,15 +1654,26 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16541654 pass
16551655
16561656 elif isinstance (propclass , Boolean ):
1657- if type (v ) is type ('' ):
1658- bv = v .lower () in ('yes' , 'true' , 'on' , '1' )
1659- else :
1660- bv = v
1657+ if type (v ) != type ([]):
1658+ v = v .split (',' )
1659+ bv = []
1660+ for val in v :
1661+ if type (val ) is type ('' ):
1662+ bv .append (val .lower () in ('yes' , 'true' , 'on' , '1' ))
1663+ else :
1664+ bv .append (val )
16611665 l .append ((OTHER , k , bv ))
1666+
1667+ elif k == 'id' :
1668+ if type (v ) != type ([]):
1669+ v = v .split (',' )
1670+ l .append ((OTHER , k , [str (int (val )) for val in v ]))
1671+
16621672 elif isinstance (propclass , Number ):
1663- l .append ((OTHER , k , float (v )))
1664- else :
1665- l .append ((OTHER , k , v ))
1673+ if type (v ) != type ([]):
1674+ v = v .split (',' )
1675+ l .append ((OTHER , k , [float (val ) for val in v ]))
1676+
16661677 filterspec = l
16671678
16681679 # now, find all the nodes that are active and pass filtering
@@ -1678,7 +1689,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16781689 # apply filter
16791690 for t , k , v in filterspec :
16801691 # handle the id prop
1681- if k == 'id' and v == nodeid :
1692+ if k == 'id' and nodeid in v :
16821693 continue
16831694
16841695 # make sure the node has the property
@@ -1726,7 +1737,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
17261737 break
17271738 elif t == OTHER :
17281739 # straight value comparison for the other types
1729- if node [k ] != v :
1740+ if node [k ] not in v :
17301741 break
17311742 else :
17321743 matches .append ([nodeid , node ])
0 commit comments