Skip to content

Commit 6f83bee

Browse files
author
Richard Jones
committed
fix to SQL lookup() and retirement
1 parent a668ec2 commit 6f83bee

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

roundup/backends/rdbms_common.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.15 2002-09-24 01:59:28 richard Exp $
1+
# $Id: rdbms_common.py,v 1.16 2002-09-24 07:39:52 richard Exp $
22

33
# standard python modules
44
import sys, os, time, re, errno, weakref, copy
@@ -1570,18 +1570,19 @@ def lookup(self, keyvalue):
15701570
if not self.key:
15711571
raise TypeError, 'No key property set for class %s'%self.classname
15721572

1573-
sql = 'select id,__retired__ from _%s where _%s=%s'%(self.classname,
1574-
self.key, self.db.arg)
1573+
sql = '''select id from _%s where _%s=%s
1574+
and __retired__ != '1' '''%(self.classname, self.key,
1575+
self.db.arg)
15751576
self.db.sql(sql, (keyvalue,))
15761577

15771578
# see if there was a result that's not retired
1578-
l = self.db.cursor.fetchall()
1579-
if not l or int(l[0][1]):
1579+
row = self.db.sql_fetchone()
1580+
if not row:
15801581
raise KeyError, 'No key (%s) value "%s" for "%s"'%(self.key,
15811582
keyvalue, self.classname)
15821583

15831584
# return the id
1584-
return l[0][0]
1585+
return row[0]
15851586

15861587
def find(self, **propspec):
15871588
'''Get the ids of nodes in this class which link to the given nodes.

0 commit comments

Comments
 (0)