X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethod.py;h=571c3ebe36f0ac568c1da01f59df3655defdf137;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=352640fced281b1dc72feac8781418d69942f6b3;hpb=f7ce7ce813d4c44502629820a3583f32a99a98f7;p=plcapi.git diff --git a/PLC/Method.py b/PLC/Method.py index 352640f..571c3eb 100644 --- a/PLC/Method.py +++ b/PLC/Method.py @@ -4,10 +4,6 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ -# $URL$ -# - import xmlrpclib from types import * import textwrap @@ -20,7 +16,7 @@ from types import StringTypes from PLC.Faults import * from PLC.Parameter import Parameter, Mixed, python_type, xmlrpc_type from PLC.Auth import Auth -from PLC.Debug import profile, log +from PLC.Debug import profile from PLC.Events import Event, Events from PLC.Nodes import Node, Nodes from PLC.Persons import Person, Persons @@ -63,13 +59,18 @@ class Method (object): return True - def __init__(self, api): + def __init__(self, api,caller=None): self.name = self.__class__.__name__ self.api = api - # Auth may set this to a Person instance (if an anonymous - # method, will remain None). - self.caller = None + if caller: + # let a method call another one by propagating its caller + self.caller=caller + else: + # Auth may set this to a Person instance (if an anonymous + # method, will remain None). + self.caller = None + # API may set this to a (addr, port) tuple if known self.source = None @@ -84,7 +85,8 @@ class Method (object): start = time.time() # legacy code cannot be type-checked, due to the way Method.args() works - if not hasattr(self,"skip_typecheck"): + # as of 5.0-rc16 we don't use skip_type_check anymore + if not hasattr(self,"skip_type_check"): (min_args, max_args, defaults) = self.args() # Check that the right number of arguments were passed in