move package imports out of __init__()
[plcapi.git] / PLC / Methods / DeleteNode.py
index 8183dd4..c97f20a 100644 (file)
@@ -1,9 +1,11 @@
-# $Id#
+# $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Auth import Auth
 from PLC.Nodes import Node, Nodes
+from PLC.SFA import SFA
 
 class DeleteNode(Method):
     """
@@ -44,10 +46,16 @@ class DeleteNode(Method):
             if node['site_id'] not in self.caller['site_ids']:
                 raise PLCPermissionDenied, "Not allowed to delete nodes from specified site"
 
+        node_id=node['node_id']
+        site_id=node['site_id']
         node.delete()
 
-       # Logging variables
-       self.event_objects = {'Node': [node['node_id']]}
-       self.message = "Node %d deleted" % node['node_id']
+        # Logging variables
+        # it's not much use to attach to the node as it's going to vanish...
+        self.event_objects = {'Node': [node_id], 'Site': [site_id] }
+        self.message = "Node %d deleted" % node['node_id']
+
+        sfa = SFA()
+        sfa.delete_record(node, 'node')       
 
         return 1