From: Tony Mack <tmack@cs.princeton.edu> Date: Mon, 10 May 2010 20:55:03 +0000 (+0000) Subject: fix bug in remove X-Git-Tag: sfa-1.0-0~202 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=d9de5d922ee22c61250c3b4eb3249f7ddd4dcf58;p=sfa.git fix bug in remove --- diff --git a/sfa/util/table.py b/sfa/util/table.py index f6090a03..83646273 100644 --- a/sfa/util/table.py +++ b/sfa/util/table.py @@ -88,16 +88,17 @@ class SfaTable(list): self.db.commit() def remove(self, record): - query_str = "DELETE FROM %s WHERE record_id = %s" % \ - (self.tablename, record['record_id']) - self.db.do(query_str) + params = {'record_id': record['record_id']} + template = "DELETE FROM %s " % self.tablename + sql = template + "WHERE record_id = %(record_id)s" + self.db.do(sql, params) # if this is a site, remove all records where 'authority' == the # site's hrn if record['type'] == 'authority': - sql = " DELETE FROM %s WHERE authority = %s" % \ - (self.tablename, record['hrn']) - self.db.do(sql) + params = {'authority': record['hrn']} + sql = template + "WHERE authority = %(authority)s" + self.db.do(sql, params) self.db.commit() def insert(self, record):