Skip to content

Commit 77baee7

Browse files
author
Richard Jones
committed
anydbm should return brand new items, even if cache is turned off
1 parent 9057390 commit 77baee7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

roundup/backends/back_anydbm.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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.101 2003-02-12 00:00:18 richard Exp $
18+
#$Id: back_anydbm.py,v 1.102 2003-02-13 07:33:38 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -299,6 +299,13 @@ def getnode(self, classname, nodeid, db=None, cache=1):
299299
if db is None:
300300
db = self.getclassdb(classname)
301301
if not db.has_key(nodeid):
302+
# try the cache - might be a brand-new node
303+
cache_dict = self.cache.setdefault(classname, {})
304+
if cache_dict.has_key(nodeid):
305+
if __debug__:
306+
print >>hyperdb.TRACE, 'get %s %s cached'%(classname,
307+
nodeid)
308+
return cache_dict[nodeid]
302309
raise IndexError, "no such %s %s"%(classname, nodeid)
303310

304311
# check the uncommitted, destroyed nodes

0 commit comments

Comments
 (0)