From b0597e697f7915fc007958354d75e5c6146d78da Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Fri, 22 Jul 2011 14:46:37 -0400 Subject: [PATCH] use xmlrpc to access plcapi until out why PLC.Shell.Shell doesn't close db connection properly --- sfa/plc/api.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sfa/plc/api.py b/sfa/plc/api.py index 28e27483..8d0e806d 100644 --- a/sfa/plc/api.py +++ b/sfa/plc/api.py @@ -111,16 +111,20 @@ class SfaAPI(BaseAPI): self.plauth = {'Username': self.config.SFA_PLC_USER, 'AuthMethod': 'password', 'AuthString': self.config.SFA_PLC_PASSWORD} - 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()) - except: - self.plshell_type = 'xmlrpc' - url = self.config.SFA_PLC_URL - shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) + + # The native shell (PLC.Shell.Shell) is more efficient than xmlrpc, + # but it leaves idle db connections open. use xmlrpc until we can figure + # out why PLC.Shell.Shell doesn't close db connection properly + #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()) + #except: + self.plshell_type = 'xmlrpc' + url = self.config.SFA_PLC_URL + shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) return shell def getCredential(self): -- 2.47.0