From: Tony Mack Date: Fri, 13 Oct 2006 21:42:25 +0000 (+0000) Subject: - fixed logging of person_id X-Git-Tag: pycurl-7_13_1~572 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0e07df3a63bf8da8364972f95b821e82bae84c55;p=plcapi.git - fixed logging of person_id --- diff --git a/PLC/Method.py b/PLC/Method.py index 14b73ae..01ec187 100644 --- a/PLC/Method.py +++ b/PLC/Method.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Method.py,v 1.2 2006/09/08 19:44:31 mlhuang Exp $ +# $Id: Method.py,v 1.3 2006/10/13 15:11:31 tmack Exp $ # import xmlrpclib @@ -101,8 +101,7 @@ class Method: break if isinstance(auth, Auth): auth.check(self, *args) - - + return self.call(*args) except PLCFault, fault: @@ -120,8 +119,8 @@ class Method: Commit the transaction """ - # Do not log listMethods call - if vars['call_name'] in ['listMethods']: + # only log api calls + if vars['call_name'] in ['listMethods', 'methodSignature']: return False sql = "INSERT INTO events " \ @@ -135,9 +134,9 @@ class Method: def wrapper(*args, **kwds): + # Gather necessary logging vars fault_code = 0 - # XX Get real person_id - person_id = 1 + person_id = 0 event_type = 'Unknown' object_type = 'Unknown' call_name = callable.im_class.__module__.split('.')[-1:][0] @@ -146,9 +145,10 @@ class Method: if hasattr(self, 'event_type'): event_type = self.event_type - if hasattr(self, 'object_type'): object_type = self.object_type + if self.caller: + person_id = self.caller['person_id'] start = time.time() @@ -162,7 +162,7 @@ class Method: fault_code = fault.faultCode runtime = time.time() - start __log__(locals()) - print fault + raise fault return wrapper