- Callable: fix func definition
authorMark Huang <mlhuang@cs.princeton.edu>
Thu, 19 Oct 2006 19:58:50 +0000 (19:58 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Thu, 19 Oct 2006 19:58:50 +0000 (19:58 +0000)
- print traceback for undefined/broken methods
- add kwds to all method calls
- only catch SyntaxErrors when falling back to executing as a statement

Shell.py

index 0c49f92..e2c25b3 100755 (executable)
--- a/Shell.py
+++ b/Shell.py
@@ -5,7 +5,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # 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: