From: Mark Huang Date: Thu, 19 Oct 2006 19:58:50 +0000 (+0000) Subject: - Callable: fix func definition X-Git-Tag: pycurl-7_13_1~525 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=050b92a13fee09756f31d658df22d1e5197fa71f;p=plcapi.git - Callable: fix func definition - print traceback for undefined/broken methods - add kwds to all method calls - only catch SyntaxErrors when falling back to executing as a statement --- diff --git a/Shell.py b/Shell.py index 0c49f924..e2c25b33 100755 --- a/Shell.py +++ b/Shell.py @@ -5,7 +5,7 @@ # Mark Huang # Copyright (C) 2005 The Trustees of Princeton University # -# $Id: Shell.py,v 1.5 2006/10/03 19:34:05 mlhuang Exp $ +# $Id: Shell.py,v 1.6 2006/10/18 19:42:46 tmack Exp $ # import os, sys @@ -155,16 +155,16 @@ class Callable: # Figure out if the function requires an authentication # structure as its first argument. self.auth = False - func = api.callable(method) try: - #func = api.callable(method) + func = api.callable(method) if func.accepts and \ (isinstance(func.accepts[0], Auth) or \ (isinstance(func.accepts[0], Mixed) and \ filter(lambda param: isinstance(param, Auth), func.accepts[0]))): self.auth = True except: + traceback.print_exc() # XXX Ignore undefined methods for now pass @@ -183,7 +183,7 @@ class Callable: (not args or not isinstance(args[0], dict) or not args[0].has_key('AuthMethod')): return self.func(auth, *args, **kwds) else: - return self.func(*args) + return self.func(*args, **kwds) if server is not None: methods = server.system.listMethods() @@ -301,7 +301,7 @@ try: result = eval(command) if result is not None: print result - except: + except SyntaxError: # Fall back to executing as a statement exec command except Exception, err: