# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: Method.py,v 1.17 2006/11/03 23:44:51 mlhuang Exp $
+# $Id: Method.py,v 1.22 2007/01/19 17:49:02 tmack Exp $
#
import xmlrpclib
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
# Log call representation
# XXX Truncate to avoid DoS
event['call'] = self.name + pprint.saferepr(args)
+ event['call_name'] = self.name
# Both users and nodes can call some methods
if isinstance(self.caller, Person):
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)
+ if hasattr(self, 'event_objects') and isinstance(self.event_objects, dict):
+ for key in self.event_objects.keys():
+ for object_id in self.event_objects[key]:
+ event.add_object(key, object_id, commit = False)
+
+ # Set the message for this event
+ if hasattr(self, 'message'):
+ event['message'] = self.message
+
# Commit
- event.sync(commit = True)
+ event.sync()
def help(self, indent = " "):
"""