svn kwds
[plcapi.git] / PLC / Methods / DeletePerson.py
index 7046e81..27a27be 100644 (file)
@@ -1,3 +1,4 @@
+# $Id$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
@@ -25,17 +26,16 @@ class DeletePerson(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    event_type = 'Delete'
-    object_type = 'Person'
-
     def call(self, auth, person_id_or_email):
         # Get account information
         persons = Persons(self.api, [person_id_or_email])
         if not persons:
             raise PLCInvalidArgument, "No such account"
-
         person = persons[0]
 
+        if person['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local account"
+
         # Authenticated function
         assert self.caller is not None
 
@@ -44,6 +44,9 @@ class DeletePerson(Method):
             raise PLCPermissionDenied, "Not allowed to delete specified account"
 
         person.delete()
-       self.object_ids = [person['person_id']]
+       
+       # Logging variables
+       self.event_objects = {'Person': [person['person_id']]}
+       self.message = 'Person %d deleted' % person['person_id']
 
         return 1