git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34fb4a4
)
fix bug in remove
author
Tony Mack
<tmack@cs.princeton.edu>
Mon, 10 May 2010 20:55:03 +0000
(20:55 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Mon, 10 May 2010 20:55:03 +0000
(20:55 +0000)
sfa/util/table.py
patch
|
blob
|
history
diff --git
a/sfa/util/table.py
b/sfa/util/table.py
index
f6090a0
..
8364627
100644
(file)
--- a/
sfa/util/table.py
+++ b/
sfa/util/table.py
@@
-88,16
+88,17
@@
class SfaTable(list):
self.db.commit()
def remove(self, record):
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':
# 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):
self.db.commit()
def insert(self, record):