Skip to content

Commit ec0bc71

Browse files
author
Anthony Baxter
committed
Fixed Py2.3 compatibility.
This code was broken for the case where getnodeids was called with 'retired=None' (which means that we want retired and unretired ids). No test case for it - I'm still trying to work out the best way to do it.
1 parent 2c4f6b5 commit ec0bc71

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

roundup/backends/rdbms_common.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.27.2.8 2003-03-24 04:53:14 richard Exp $
1+
# $Id: rdbms_common.py,v 1.27.2.9 2003-06-24 08:18:19 anthonybaxter Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -720,13 +720,16 @@ def getnodeids(self, classname, retired=0):
720720
Set retired=None to get all nodes. Otherwise it'll get all the
721721
retired or non-retired nodes, depending on the flag.
722722
'''
723-
# flip the sense of the flag if we don't want all of them
723+
# flip the sense of the 'retired' flag if we don't want all of them
724724
if retired is not None:
725-
retired = not retired
726-
sql = 'select id from _%s where __retired__ <> %s'%(classname, self.arg)
725+
args = (((retired==0) and 1) or 0,)
726+
sql = 'select id from _%s where __retired__ <> %s'%(classname, self.arg)
727+
else:
728+
args = ()
729+
sql = 'select id from _%s'%(classname,)
727730
if __debug__:
728-
print >>hyperdb.DEBUG, 'getnodeids', (self, sql, retired)
729-
self.cursor.execute(sql, (retired,))
731+
print >>hyperdb.DEBUG, 'getnodeids', (self, sql, args)
732+
self.cursor.execute(sql, args)
730733
return [x[0] for x in self.cursor.fetchall()]
731734

732735
def addjournal(self, classname, nodeid, action, params, creator=None,

0 commit comments

Comments
 (0)