From 06dae4d767ea1d16a62631a7509c8598e1abda85 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 24 Sep 2002 07:39:52 +0000 Subject: [PATCH] fix to SQL lookup() and retirement git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1227 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/backends/rdbms_common.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/roundup/backends/rdbms_common.py b/roundup/backends/rdbms_common.py index b0eb498..e9bef54 100644 --- a/roundup/backends/rdbms_common.py +++ b/roundup/backends/rdbms_common.py @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.15 2002-09-24 01:59:28 richard Exp $ +# $Id: rdbms_common.py,v 1.16 2002-09-24 07:39:52 richard Exp $ # standard python modules import sys, os, time, re, errno, weakref, copy @@ -1570,18 +1570,19 @@ class Class(hyperdb.Class): if not self.key: raise TypeError, 'No key property set for class %s'%self.classname - sql = 'select id,__retired__ from _%s where _%s=%s'%(self.classname, - self.key, self.db.arg) + sql = '''select id from _%s where _%s=%s + and __retired__ != '1' '''%(self.classname, self.key, + self.db.arg) self.db.sql(sql, (keyvalue,)) # see if there was a result that's not retired - l = self.db.cursor.fetchall() - if not l or int(l[0][1]): + row = self.db.sql_fetchone() + if not row: raise KeyError, 'No key (%s) value "%s" for "%s"'%(self.key, keyvalue, self.classname) # return the id - return l[0][0] + return row[0] def find(self, **propspec): '''Get the ids of nodes in this class which link to the given nodes. -- 2.30.2