From 8c2ea05e14c82591f084951b64b938dab4ce4254 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Fri, 5 Mar 2010 20:17:31 +0000 Subject: [PATCH] reverting last commit (we can attempt to import plcapi source again. The problem that this was previously creating has been resolved by fixing sfa.util.table.SfaTable and sfa.util.PostgreSQL) --- sfa/plc/api.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sfa/plc/api.py b/sfa/plc/api.py index cd6b2bde..52f72ffa 100644 --- a/sfa/plc/api.py +++ b/sfa/plc/api.py @@ -69,13 +69,22 @@ class SfaAPI(BaseAPI): self.plauth = {'Username': self.config.SFA_PLC_USER, 'AuthMethod': 'password', 'AuthString': self.config.SFA_PLC_PASSWORD} - # connect via xmlrpc - self.plshell_type = 'xmlrpc' - url = self.config.SFA_PLC_URL - shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) - shell.AuthCheck(self.plauth) - return shell - + + try: + sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh"))) + self.plshell_type = 'direct' + import PLC.Shell + shell = PLC.Shell.Shell(globals = globals()) + shell.AuthCheck(self.plauth) + return shell + except ImportError: + self.plshell_type = 'xmlrpc' + # connect via xmlrpc + url = self.config.SFA_PLC_URL + shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) + shell.AuthCheck(self.plauth) + return shell + def getPLCShellVersion(self): # We need to figure out what version of PLCAPI we are talking to. # Some calls we need to make later will be different depending on -- 2.43.0