Skip to content

Commit b15a457

Browse files
committed
Fix issue2550501
1 parent e4bbfc8 commit b15a457

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

roundup/backends/rdbms_common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,12 @@ def destroynode(self, classname, nodeid):
10731073
def hasnode(self, classname, nodeid):
10741074
""" Determine if the database has a given node.
10751075
"""
1076+
# If this node is in the cache, then we do not need to go to
1077+
# the database. (We don't consider this an LRU hit, though.)
1078+
if self.cache.has_key((classname, nodeid)):
1079+
# Return 1, not True, to match the type of the result of
1080+
# the SQL operation below.
1081+
return 1
10761082
sql = 'select count(*) from _%s where id=%s'%(classname, self.arg)
10771083
self.sql(sql, (nodeid,))
10781084
return int(self.cursor.fetchone()[0])
@@ -1705,6 +1711,12 @@ def set_inner(self, nodeid, **propvalues):
17051711

17061712
# handle additions
17071713
for id in value:
1714+
# If this node is in the cache, then we do not need to go to
1715+
# the database. (We don't consider this an LRU hit, though.)
1716+
if self.cache.has_key((classname, nodeid)):
1717+
# Return 1, not True, to match the type of the result of
1718+
# the SQL operation below.
1719+
return 1
17081720
if not self.db.getclass(link_class).hasnode(id):
17091721
raise IndexError, '%s has no node %s'%(link_class, id)
17101722
if id in l:

0 commit comments

Comments
 (0)