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.116 2003-03-26 05:30:23 richard Exp $
18+ #$Id: back_anydbm.py,v 1.117 2003-03-26 10:43:59 richard Exp $
1919'''
2020This module defines a backend that saves the hyperdatabase in a database
2121chosen by anydbm. It is guaranteed to always be available in python
@@ -1462,23 +1462,23 @@ def lookup(self, keyvalue):
14621462
14631463 # change from spec - allows multiple props to match
14641464 def find (self , ** propspec ):
1465- '''Get the ids of nodes in this class which link to the given nodes .
1465+ '''Get the ids of items in this class which link to the given items .
14661466
1467- 'propspec' consists of keyword args propname=nodeid or
1468- propname={nodeid :1, }
1467+ 'propspec' consists of keyword args propname=itemid or
1468+ propname={itemid :1, }
14691469 'propname' must be the name of a property in this class, or a
14701470 KeyError is raised. That property must be a Link or
14711471 Multilink property, or a TypeError is raised.
14721472
1473- Any node in this class whose 'propname' property links to any of the
1474- nodeids will be returned. Used by the full text indexing, which knows
1473+ Any item in this class whose 'propname' property links to any of the
1474+ itemids will be returned. Used by the full text indexing, which knows
14751475 that "foo" occurs in msg1, msg3 and file7, so we have hits on these
14761476 issues:
14771477
14781478 db.issue.find(messages={'1':1,'3':1}, files={'7':1})
14791479 '''
14801480 propspec = propspec .items ()
1481- for propname , nodeids in propspec :
1481+ for propname , itemids in propspec :
14821482 # check the prop is OK
14831483 prop = self .properties [propname ]
14841484 if not isinstance (prop , Link ) and not isinstance (prop , Multilink ):
@@ -1489,24 +1489,26 @@ def find(self, **propspec):
14891489 l = []
14901490 try :
14911491 for id in self .getnodeids (db = cldb ):
1492- node = self .db .getnode (self .classname , id , db = cldb )
1493- if node .has_key (self .db .RETIRED_FLAG ):
1492+ item = self .db .getnode (self .classname , id , db = cldb )
1493+ if item .has_key (self .db .RETIRED_FLAG ):
14941494 continue
1495- for propname , nodeids in propspec :
1496- # can't test if the node doesn't have this property
1497- if not node .has_key (propname ):
1495+ for propname , itemids in propspec :
1496+ # can't test if the item doesn't have this property
1497+ if not item .has_key (propname ):
14981498 continue
1499- if type (nodeids ) is type ('' ):
1500- nodeids = {nodeids :1 }
1499+ if type (itemids ) is not type ({}):
1500+ itemids = {itemids :1 }
1501+
1502+ # grab the property definition and its value on this item
15011503 prop = self .properties [propname ]
1502- value = node [propname ]
1503- if isinstance (prop , Link ) and nodeids .has_key (value ):
1504+ value = item [propname ]
1505+ if isinstance (prop , Link ) and itemids .has_key (value ):
15041506 l .append (id )
15051507 break
15061508 elif isinstance (prop , Multilink ):
15071509 hit = 0
15081510 for v in value :
1509- if nodeids .has_key (v ):
1511+ if itemids .has_key (v ):
15101512 l .append (id )
15111513 hit = 1
15121514 break
0 commit comments