- Auth() now implies BootAuth()
[plcapi.git] / PLC / Method.py
index 2b062d1..70b8b21 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Method.py,v 1.18 2006/11/08 22:11:26 mlhuang Exp $
+# $Id: Method.py,v 1.21 2007/01/16 17:04:08 mlhuang Exp $
 #
 
 import xmlrpclib
@@ -92,7 +92,7 @@ class Method:
            result = self.call(*args, **kwds)
            runtime = time.time() - start
 
-            if self.api.config.PLC_API_DEBUG:
+            if self.api.config.PLC_API_DEBUG or hasattr(self, 'message'):
                self.log(0, runtime, *args)
                
            return result
@@ -139,13 +139,19 @@ class Method:
 
         event.sync(commit = False)
 
-        # XXX object_ids is currently defined as a class variable
         if hasattr(self, 'object_ids'):
             for object_id in self.object_ids:
                 event.add_object(object_id, commit = False)
 
+       # Set the message for this event
+       if hasattr(self, 'message'):
+            event['message'] = self.message    
+       
+       if hasattr(self, 'object_type'):
+          event['object_type'] = self.object_type
+
         # Commit
-        event.sync(commit = True)
+        event.sync()
 
     def help(self, indent = "  "):
         """