use session.delete(x) rather than del x
Thierry Parmentelat [Thu, 19 Jan 2012 17:33:42 +0000 (18:33 +0100)]
sfa/importer/sfa-import-openstack.py
sfa/importer/sfa-import-plc.py
sfa/managers/registry_manager.py
sfa/server/sfa-start.py
sfa/storage/alchemy.py

index 9794ec7..ae3d897 100755 (executable)
@@ -155,7 +155,7 @@ def main():
         
         record_object = existing_records[ (record_hrn, type) ]
         logger.info("Import: removing %s " % record.summary_string())
-        del record_object
+        dbsession.delete(record_object)
         dbsession.commit()
                                    
     # save pub keys
index 768473f..9076237 100755 (executable)
@@ -343,7 +343,7 @@ def main():
             try:
                 record_object = existing_records[(record_hrn, type)]
                 logger.info("Import: deleting record: %s" % record)
-                del record_object
+                dbsession.delete(record_object)
                 dbsession.commit()
             except:
                 logger.log_exc("Import: failded to delete record")                    
index 218d62b..e40772d 100644 (file)
@@ -385,7 +385,7 @@ class RegistryManager:
             logger.warning("driver.remove failed")
 
         # delete from sfa db
-        del record
+        dbsession.delete(record)
         dbsession.commit()
     
         return 1
index 1f22215..8355d1c 100755 (executable)
@@ -144,7 +144,7 @@ def update_cert_records(gids):
     for record in records_found:
         if record.hrn not in hrns_expected and \
             record.hrn != self.api.config.SFA_INTERFACE_HRN:
-            del record
+            dbsession.delete(record)
 
     # TODO: store urn in the db so we do this in 1 query 
     for gid in gids:
index e83a0f1..ead5219 100644 (file)
@@ -73,7 +73,7 @@ class Alchemy:
         self.commit()
 
     def remove (self, record):
-        del record
+        self.delete(record)
         self.commit()
 
 ####################