From: Tony Mack Date: Mon, 28 Dec 2009 15:52:31 +0000 (+0000) Subject: when removing a site make sure to remove all records at the site X-Git-Tag: sfa-0.9-7~77 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=11228bd33c8b53585d983445af28425e98dcf3f4;p=sfa.git when removing a site make sure to remove all records at the site --- diff --git a/sfa/util/genitable.py b/sfa/util/genitable.py index 80a4ddab..bf436bcd 100644 --- a/sfa/util/genitable.py +++ b/sfa/util/genitable.py @@ -92,8 +92,16 @@ class GeniTable(list): self.cnx.query(index) def remove(self, record): - query_str = "DELETE FROM %s WHERE record_id = %s" % (self.tablename, record['record_id']) + query_str = "DELETE FROM %s WHERE record_id = %s" % \ + (self.tablename, record['record_id']) self.cnx.query(query_str) + + # if this is a site, remove all records where 'authority' == the + # site's hrn + if record['type'] == 'site': + sql = " DELETE FROM %s WHERE authority = %s" % \ + (self.tablename, record['hrn']) + self.cnx.query(sql) def insert(self, record): db_fields = self.db_fields(record)