Delete the site from sfa before we delete from plc, otherwise sfa wont have enough...
[plcapi.git] / PLC / Methods / DeleteSite.py
index 381bdf3..f3196cc 100644 (file)
@@ -1,4 +1,5 @@
 # $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
@@ -7,6 +8,7 @@ from PLC.Persons import Person, Persons
 from PLC.Nodes import Node, Nodes
 from PLC.PCUs import PCU, PCUs
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 class DeleteSite(Method):
     """
@@ -38,10 +40,15 @@ class DeleteSite(Method):
         if site['peer_id'] is not None:
             raise PLCInvalidArgument, "Not a local site"
 
+        # sync with sfa db
+        sfa = SFA()
+        sfa.delete_record(site, 'site')
+        
         site.delete()
        
-       # Logging variables
-       self.event_objects = {'Site': [site['site_id']]}
-       self.message = 'Site %d deleted' % site['site_id']      
+        # Logging variables
+        self.event_objects = {'Site': [site['site_id']]}
+        self.message = 'Site %d deleted' % site['site_id']     
 
+        
         return 1