- append parent directory to sys.path
authorMark Huang <mlhuang@cs.princeton.edu>
Fri, 27 Oct 2006 15:26:44 +0000 (15:26 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Fri, 27 Oct 2006 15:26:44 +0000 (15:26 +0000)
- automagically add SessionAuth, too

Shell.py

index c007315..613d40a 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
 #
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2005 The Trustees of Princeton University
 #
-# $Id: Shell.py,v 1.7 2006/10/19 19:58:50 mlhuang Exp $
+# $Id: Shell.py,v 1.8 2006/10/20 18:25:39 mlhuang Exp $
 #
 
 import os, sys
 #
 
 import os, sys
@@ -16,6 +16,9 @@ import pg
 import xmlrpclib
 import getpass
 
 import xmlrpclib
 import getpass
 
+# Append PLC to the system path
+sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
+
 from PLC.API import PLCAPI
 from PLC.Parameter import Mixed
 from PLC.Auth import Auth
 from PLC.API import PLCAPI
 from PLC.Parameter import Mixed
 from PLC.Auth import Auth
@@ -178,7 +181,9 @@ class Callable:
         """
 
         if self.auth and \
         """
 
         if self.auth and \
-           (not args or not isinstance(args[0], dict) or not args[0].has_key('AuthMethod')):
+           (not args or not isinstance(args[0], dict) or \
+            (not args[0].has_key('AuthMethod') and \
+             not args[0].has_key('session'))):
             return self.func(auth, *args, **kwds)
         else:
             return self.func(*args, **kwds)
             return self.func(auth, *args, **kwds)
         else:
             return self.func(*args, **kwds)