From: erickson Date: Tue, 17 Jul 2007 14:07:43 +0000 (+0000) Subject: added config contexts for config files. fixed some osrfNetworkObject handling bugs... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=935cfcf57bd4c91d87f98d915ab3ffed2a49d0bf;p=opensrf%2Fbjwebb.git added config contexts for config files. fixed some osrfNetworkObject handling bugs. did some re-tabbing to change to space-based tabs git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1041 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/python/osrf/conf.py b/src/python/osrf/conf.py index 34e8df3..74f8bd9 100644 --- a/src/python/osrf/conf.py +++ b/src/python/osrf/conf.py @@ -16,33 +16,56 @@ from osrf.utils import * from osrf.ex import * +import re class osrfConfig(object): - """Loads and parses the bootstrap config file""" + """Loads and parses the bootstrap config file""" - config = None + config = None - def __init__(self, file=None): - self.file = file - self.data = {} + def __init__(self, file, context=None): + self.file = file + self.context = context + self.data = {} - def parseConfig(self,file=None): - self.data = osrfXMLFileToObject(file or self.file) - osrfConfig.config = self - - def getValue(self, key, idx=None): - val = osrfObjectFindPath(self.data, key, idx) - if not val: - raise osrfConfigException("Config value not found: " + key) - return val + #def parseConfig(self,file=None): + def parseConfig(self): + self.data = osrfXMLFileToObject(self.file) + osrfConfig.config = self + + def getValue(self, key, idx=None): + if self.context: + if re.search('/', key): + key = "%s/%s" % (self.context, key) + else: + key = "%s.%s" % (self.context, key) + + val = osrfObjectFindPath(self.data, key, idx) + if not val: + raise osrfConfigException("Config value not found: " + key) + return val def osrfConfigValue(key, idx=None): - """Returns a bootstrap config value. - - key -- A string representing the path to the value in the config object - e.g. "domains.domain", "username" - idx -- Optional array index if the searched value is an array member - """ - return osrfConfig.config.getValue(key, idx) - + """Returns a bootstrap config value. + + key -- A string representing the path to the value in the config object + e.g. "domains.domain", "username" + idx -- Optional array index if the searched value is an array member + """ + return osrfConfig.config.getValue(key, idx) + + +def osrfConfigValueNoEx(key, idx=None): + """ Returns a bootstrap config value without throwing an exception + if the item is not found. + + key -- A string representing the path to the value in the config object + e.g. "domains.domain", "username" + idx -- Optional array index if the searched value is an array member + """ + try: + return osrfConfig.config.getValue(key, idx) + except: + return None + diff --git a/src/python/osrf/log.py b/src/python/osrf/log.py index f0ef2ad..187a34d 100644 --- a/src/python/osrf/log.py +++ b/src/python/osrf/log.py @@ -22,9 +22,14 @@ def osrfInitLog(level, facility=None, file=None): """Initialize the logging subsystem.""" import syslog global loglevel - if facility: osrfInitSyslog(facility, level) + if facility: + osrfInitSyslog(facility, level) + syslog.syslog(syslog.LOG_DEBUG, "syslog initialized") + else: + if file: + sys.stderr.write("\n * file-based logging not implemented yet\n") + loglevel = level - syslog.syslog(LOG_DEBUG, "syslog initialized") # ----------------------------------------------------------------------- @@ -72,6 +77,8 @@ def __osrfLog(level, msg): def osrfInitSyslog(facility, level): """Connect to syslog and set the logmask based on the level provided.""" + import syslog + level = int(level) if facility == 'local0': facility = syslog.LOG_LOCAL0 @@ -82,13 +89,13 @@ def osrfInitSyslog(facility, level): if facility == 'local5': facility = syslog.LOG_LOCAL5 if facility == 'local6': facility = syslog.LOG_LOCAL6 # XXX add other facility maps if necessary - openlog(sys.argv[0], 0, facility) + syslog.openlog(sys.argv[0], 0, facility) # this is redundant... - mask = LOG_UPTO(syslog.LOG_ERR) - if level >= 1: mask |= LOG_MASK(syslog.LOG_WARNING) - if level >= 2: mask |= LOG_MASK(syslog.LOG_NOTICE) - if level >= 3: mask |= LOG_MASK(syslog.LOG_INFO) - if level >= 4: mask |= LOG_MASK(syslog.LOG_DEBUG) + mask = syslog.LOG_UPTO(syslog.LOG_ERR) + if level >= 1: mask |= syslog.LOG_MASK(syslog.LOG_WARNING) + if level >= 2: mask |= syslog.LOG_MASK(syslog.LOG_NOTICE) + if level >= 3: mask |= syslog.LOG_MASK(syslog.LOG_INFO) + if level >= 4: mask |= syslog.LOG_MASK(syslog.LOG_DEBUG) syslog.setlogmask(mask) diff --git a/src/python/osrf/net_obj.py b/src/python/osrf/net_obj.py index 792c613..8ae3b9b 100644 --- a/src/python/osrf/net_obj.py +++ b/src/python/osrf/net_obj.py @@ -13,7 +13,6 @@ def osrfNewObjectFromHint(hint): return obj except AttributeError: return osrfNetworkObject.__unknown() -#newFromHint = staticmethod(newFromHint) ''' Global object registry ''' @@ -76,9 +75,8 @@ def __osrfNetworkObjectInit(self, data={}): If this is an array, we pull data out of the data array (if there is any) and translate that into a hash internally ''' - self.__data = data - if len(data) > 0: + if isinstance(data, list) and len(data) > 0: reg = self.getRegistry() if reg.wireProtocol == 'array': self.__data = {} @@ -134,31 +132,47 @@ osrfNetworkRegisterHint('__unknown', [], 'hash') # Define the custom object parsing behavior # ------------------------------------------------------------------- def parseNetObject(obj): - hint = None - islist = False + try: + hint = obj[OSRF_JSON_CLASS_KEY] - obj = obj[OSRF_JSON_PAYLOAD_KEY] - except: pass - if isinstance(obj,list): - islist = True - for i in range(len(obj)): - obj[i] = parseNetObject(obj[i]) - else: - if isinstance(obj,dict): - for k,v in obj.iteritems(): - obj[k] = parseNetObject(v) + subObj = obj[OSRF_JSON_PAYLOAD_KEY] + reg = osrfNetworkRegistry.getRegistry(hint) + + obj = {} + + if reg.wireProtocol == 'array': + for i in range(len(reg.keys)): + if len(subObj) > i: + obj[reg.keys[i]] = parseNetObject(subObj[i]) + else: + obj[reg.keys[i]] = None + else: + for k in reg.keys: + obj[k] = parseNetObject(subObj.get(k)) - if hint: # Now, "bless" the object into an osrfNetworkObject estr = 'obj = osrfNetworkObject.%s(obj)' % hint try: exec(estr) - except AttributeError: + except e: # this object has not been registered, shove it into the default container obj = osrfNetworkObject.__unknown(obj) - return obj; + return obj + + except: pass + + # the current object does not have a class hint + if isinstance(obj, list): + for i in range(len(obj)): + obj[i] = parseNetObject(obj[i]) + + else: + if isinstance(obj, dict): + for k,v in obj.iteritems(): + obj[k] = parseNetObject(v) + return obj; def osrfObjectToXML(obj): diff --git a/src/python/osrf/ses.py b/src/python/osrf/ses.py index f1c6c38..462ae08 100644 --- a/src/python/osrf/ses.py +++ b/src/python/osrf/ses.py @@ -33,276 +33,276 @@ osrfNetworkRegisterHint('osrfMethodException', ['status', 'statusCode'], 'hash') class osrfSession(object): - """Abstract session superclass.""" + """Abstract session superclass.""" - def __init__(self): - # by default, we're connected to no one - self.state = OSRF_APP_SESSION_DISCONNECTED + def __init__(self): + # by default, we're connected to no one + self.state = OSRF_APP_SESSION_DISCONNECTED - def wait(self, timeout=120): - """Wait up to seconds for data to arrive on the network""" - osrfLogInternal("osrfSession.wait(%d)" % timeout) - handle = osrfGetNetworkHandle() - handle.recv(timeout) + def wait(self, timeout=120): + """Wait up to seconds for data to arrive on the network""" + osrfLogInternal("osrfSession.wait(%d)" % timeout) + handle = osrfGetNetworkHandle() + handle.recv(timeout) - def send(self, omessage): - """Sends an OpenSRF message""" - netMessage = osrfNetworkMessage( - to = self.remoteId, - body = osrfObjectToJSON([omessage]), - thread = self.thread ) + def send(self, omessage): + """Sends an OpenSRF message""" + netMessage = osrfNetworkMessage( + to = self.remoteId, + body = osrfObjectToJSON([omessage]), + thread = self.thread ) - handle = osrfGetNetworkHandle() - handle.send(netMessage) + handle = osrfGetNetworkHandle() + handle.send(netMessage) - def cleanup(self): - """Removes the session from the global session cache.""" - del osrfClientSession.sessionCache[self.thread] + def cleanup(self): + """Removes the session from the global session cache.""" + del osrfClientSession.sessionCache[self.thread] class osrfClientSession(osrfSession): - """Client session object. Use this to make server requests.""" - - def __init__(self, service): - - # call superclass constructor - osrfSession.__init__(self) - - # the remote service we want to make requests of - self.service = service - - # find the remote service handle @/ - domain = osrfConfigValue('domains.domain', 0) - router = osrfConfigValue('router_name') - self.remoteId = "%s@%s/%s" % (router, domain, service) - self.origRemoteId = self.remoteId - - # generate a random message thread - self.thread = "%s%s%s" % (os.getpid(), str(random.randint(100,100000)), str(time.time())) - - # how many requests this session has taken part in - self.nextId = 0 - - # cache of request objects - self.requests = {} - - # cache this session in the global session cache - osrfClientSession.sessionCache[self.thread] = self - - def resetRequestTimeout(self, rid): - req = self.findRequest(rid) - if req: - req.resetTimeout = True - - - def request2(self, method, arr): - """Creates a new request and sends the request to the server using a python array as the params.""" - return self.__request(method, arr) - - def request(self, method, *args): - """Creates a new request and sends the request to the server using a variable argument list as params""" - arr = list(args) - return self.__request(method, arr) - - def __request(self, method, arr): - """Builds the request object and sends it.""" - if self.state != OSRF_APP_SESSION_CONNECTED: - self.resetRemoteId() - - osrfLogDebug("Sending request %s -> %s " % (self.service, method)) - req = osrfRequest(self, self.nextId, method, arr) - self.requests[str(self.nextId)] = req - self.nextId += 1 - req.send() - return req - - - def connect(self, timeout=10): - """Connects to a remote service""" - - if self.state == OSRF_APP_SESSION_CONNECTED: - return True - self.state == OSRF_APP_SESSION_CONNECTING - - # construct and send a CONNECT message - self.send( - osrfNetworkObject.osrfMessage( - { 'threadTrace' : 0, - 'type' : OSRF_MESSAGE_TYPE_CONNECT - } - ) - ) - - while timeout >= 0 and not self.state == OSRF_APP_SESSION_CONNECTED: - start = time.time() - self.wait(timeout) - timeout -= time.time() - start - - if self.state != OSRF_APP_SESSION_CONNECTED: - raise osrfServiceException("Unable to connect to " + self.service) - - return True - - def disconnect(self): - """Disconnects from a remote service""" - - if self.state == OSRF_APP_SESSION_DISCONNECTED: - return True - - self.send( - osrfNetworkObject.osrfMessage( - { 'threadTrace' : 0, - 'type' : OSRF_MESSAGE_TYPE_DISCONNECT - } - ) - ) - - self.state = OSRF_APP_SESSION_DISCONNECTED - - - - - def setRemoteId(self, remoteid): - self.remoteId = remoteid - osrfLogInternal("Setting request remote ID to %s" % self.remoteId) - - def resetRemoteId(self): - """Recovers the original remote id""" - self.remoteId = self.origRemoteId - osrfLogInternal("Resetting remote ID to %s" % self.remoteId) - - def pushResponseQueue(self, message): - """Pushes the message payload onto the response queue - for the request associated with the message's ID.""" - osrfLogDebug("pushing %s" % message.payload()) - try: - self.findRequest(message.threadTrace()).pushResponse(message.payload()) - except Exception, e: - osrfLogWarn("pushing respond to non-existent request %s : %s" % (message.threadTrace(), e)) - - def findRequest(self, rid): - """Returns the original request matching this message's threadTrace.""" - try: - return self.requests[str(rid)] - except KeyError: - osrfLogDebug('findRequest(): non-existent request %s' % str(rid)) - return None + """Client session object. Use this to make server requests.""" + + def __init__(self, service): + + # call superclass constructor + osrfSession.__init__(self) + + # the remote service we want to make requests of + self.service = service + + # find the remote service handle @/ + domain = osrfConfigValue('domains.domain', 0) + router = osrfConfigValue('router_name') + self.remoteId = "%s@%s/%s" % (router, domain, service) + self.origRemoteId = self.remoteId + + # generate a random message thread + self.thread = "%s%s%s" % (os.getpid(), str(random.randint(100,100000)), str(time.time())) + + # how many requests this session has taken part in + self.nextId = 0 + + # cache of request objects + self.requests = {} + + # cache this session in the global session cache + osrfClientSession.sessionCache[self.thread] = self + + def resetRequestTimeout(self, rid): + req = self.findRequest(rid) + if req: + req.resetTimeout = True + + + def request2(self, method, arr): + """Creates a new request and sends the request to the server using a python array as the params.""" + return self.__request(method, arr) + + def request(self, method, *args): + """Creates a new request and sends the request to the server using a variable argument list as params""" + arr = list(args) + return self.__request(method, arr) + + def __request(self, method, arr): + """Builds the request object and sends it.""" + if self.state != OSRF_APP_SESSION_CONNECTED: + self.resetRemoteId() + + osrfLogDebug("Sending request %s -> %s " % (self.service, method)) + req = osrfRequest(self, self.nextId, method, arr) + self.requests[str(self.nextId)] = req + self.nextId += 1 + req.send() + return req + + + def connect(self, timeout=10): + """Connects to a remote service""" + + if self.state == OSRF_APP_SESSION_CONNECTED: + return True + self.state == OSRF_APP_SESSION_CONNECTING + + # construct and send a CONNECT message + self.send( + osrfNetworkObject.osrfMessage( + { 'threadTrace' : 0, + 'type' : OSRF_MESSAGE_TYPE_CONNECT + } + ) + ) + + while timeout >= 0 and not self.state == OSRF_APP_SESSION_CONNECTED: + start = time.time() + self.wait(timeout) + timeout -= time.time() - start + + if self.state != OSRF_APP_SESSION_CONNECTED: + raise osrfServiceException("Unable to connect to " + self.service) + + return True + + def disconnect(self): + """Disconnects from a remote service""" + + if self.state == OSRF_APP_SESSION_DISCONNECTED: + return True + + self.send( + osrfNetworkObject.osrfMessage( + { 'threadTrace' : 0, + 'type' : OSRF_MESSAGE_TYPE_DISCONNECT + } + ) + ) + + self.state = OSRF_APP_SESSION_DISCONNECTED + + + + + def setRemoteId(self, remoteid): + self.remoteId = remoteid + osrfLogInternal("Setting request remote ID to %s" % self.remoteId) + + def resetRemoteId(self): + """Recovers the original remote id""" + self.remoteId = self.origRemoteId + osrfLogInternal("Resetting remote ID to %s" % self.remoteId) + + def pushResponseQueue(self, message): + """Pushes the message payload onto the response queue + for the request associated with the message's ID.""" + osrfLogDebug("pushing %s" % message.payload()) + try: + self.findRequest(message.threadTrace()).pushResponse(message.payload()) + except Exception, e: + osrfLogWarn("pushing respond to non-existent request %s : %s" % (message.threadTrace(), e)) + + def findRequest(self, rid): + """Returns the original request matching this message's threadTrace.""" + try: + return self.requests[str(rid)] + except KeyError: + osrfLogDebug('findRequest(): non-existent request %s' % str(rid)) + return None osrfSession.sessionCache = {} def osrfFindSession(thread): - """Finds a session in the global cache.""" - try: - return osrfClientSession.sessionCache[thread] - except: return None + """Finds a session in the global cache.""" + try: + return osrfClientSession.sessionCache[thread] + except: return None class osrfRequest(object): - """Represents a single OpenSRF request. - A request is made and any resulting respones are - collected for the client.""" - - def __init__(self, session, id, method=None, params=[]): - - self.session = session # my session handle - self.id = id # my unique request ID - self.method = method # method name - self.params = params # my method params - self.queue = [] # response queue - self.resetTimeout = False # resets the recv timeout? - self.complete = False # has the server told us this request is done? - self.sendTime = 0 # local time the request was put on the wire - self.completeTime = 0 # time the server told us the request was completed - self.firstResponseTime = 0 # time it took for our first reponse to be received - - def send(self): - """Sends a request message""" - - # construct the method object message with params and method name - method = osrfNetworkObject.osrfMethod( { - 'method' : self.method, - 'params' : self.params - } ) - - # construct the osrf message with our method message embedded - message = osrfNetworkObject.osrfMessage( { - 'threadTrace' : self.id, - 'type' : OSRF_MESSAGE_TYPE_REQUEST, - 'payload' : method - } ) - - self.sendTime = time.time() - self.session.send(message) - - def recv(self, timeout=120): - """Waits up to seconds for a response to this request. - - If a message is received in time, the response message is returned. - Returns None otherwise.""" - - self.session.wait(0) - - origTimeout = timeout - while not self.complete and timeout >= 0 and len(self.queue) == 0: - s = time.time() - self.session.wait(timeout) - timeout -= time.time() - s - if self.resetTimeout: - self.resetTimeout = False - timeout = origTimeout - - now = time.time() - - # ----------------------------------------------------------------- - # log some statistics - if len(self.queue) > 0: - if not self.firstResponseTime: - self.firstResponseTime = now - osrfLogDebug("time elapsed before first response: %f" \ - % (self.firstResponseTime - self.sendTime)) - - if self.complete: - if not self.completeTime: - self.completeTime = now - osrfLogDebug("time elapsed before complete: %f" \ - % (self.completeTime - self.sendTime)) - # ----------------------------------------------------------------- - - - if len(self.queue) > 0: - # we have a reponse, return it - return self.queue.pop(0) - - return None - - def pushResponse(self, content): - """Pushes a method response onto this requests response queue.""" - self.queue.append(content) - - def cleanup(self): - """Cleans up request data from the cache. - - Do this when you are done with a request to prevent "leaked" cache memory.""" - del self.session.requests[str(self.id)] - - def setComplete(self): - """Sets me as complete. This means the server has sent a 'request complete' message""" - self.complete = True + """Represents a single OpenSRF request. + A request is made and any resulting respones are + collected for the client.""" + + def __init__(self, session, id, method=None, params=[]): + + self.session = session # my session handle + self.id = id # my unique request ID + self.method = method # method name + self.params = params # my method params + self.queue = [] # response queue + self.resetTimeout = False # resets the recv timeout? + self.complete = False # has the server told us this request is done? + self.sendTime = 0 # local time the request was put on the wire + self.completeTime = 0 # time the server told us the request was completed + self.firstResponseTime = 0 # time it took for our first reponse to be received + + def send(self): + """Sends a request message""" + + # construct the method object message with params and method name + method = osrfNetworkObject.osrfMethod( { + 'method' : self.method, + 'params' : self.params + } ) + + # construct the osrf message with our method message embedded + message = osrfNetworkObject.osrfMessage( { + 'threadTrace' : self.id, + 'type' : OSRF_MESSAGE_TYPE_REQUEST, + 'payload' : method + } ) + + self.sendTime = time.time() + self.session.send(message) + + def recv(self, timeout=120): + """Waits up to seconds for a response to this request. + + If a message is received in time, the response message is returned. + Returns None otherwise.""" + + self.session.wait(0) + + origTimeout = timeout + while not self.complete and timeout >= 0 and len(self.queue) == 0: + s = time.time() + self.session.wait(timeout) + timeout -= time.time() - s + if self.resetTimeout: + self.resetTimeout = False + timeout = origTimeout + + now = time.time() + + # ----------------------------------------------------------------- + # log some statistics + if len(self.queue) > 0: + if not self.firstResponseTime: + self.firstResponseTime = now + osrfLogDebug("time elapsed before first response: %f" \ + % (self.firstResponseTime - self.sendTime)) + + if self.complete: + if not self.completeTime: + self.completeTime = now + osrfLogDebug("time elapsed before complete: %f" \ + % (self.completeTime - self.sendTime)) + # ----------------------------------------------------------------- + + + if len(self.queue) > 0: + # we have a reponse, return it + return self.queue.pop(0) + + return None + + def pushResponse(self, content): + """Pushes a method response onto this requests response queue.""" + self.queue.append(content) + + def cleanup(self): + """Cleans up request data from the cache. + + Do this when you are done with a request to prevent "leaked" cache memory.""" + del self.session.requests[str(self.id)] + + def setComplete(self): + """Sets me as complete. This means the server has sent a 'request complete' message""" + self.complete = True class osrfServerSession(osrfSession): - """Implements a server-side session""" - pass + """Implements a server-side session""" + pass def osrfAtomicRequest(service, method, *args): - ses = osrfClientSession(service) - req = ses.request2('open-ils.cstore.direct.actor.user.retrieve', list(args)) # grab user with ID 1 - resp = req.recv() - data = resp.content() - req.cleanup() - ses.cleanup() - return data + ses = osrfClientSession(service) + req = ses.request2(method, list(args)) + resp = req.recv() + data = resp.content() + req.cleanup() + ses.cleanup() + return data diff --git a/src/python/osrf/system.py b/src/python/osrf/system.py index 4a978a5..bfc5463 100644 --- a/src/python/osrf/system.py +++ b/src/python/osrf/system.py @@ -13,7 +13,7 @@ # GNU General Public License for more details. # ----------------------------------------------------------------------- -from osrf.conf import osrfConfig, osrfConfigValue +from osrf.conf import osrfConfig, osrfConfigValue, osrfConfigValueNoEx from osrf.net import osrfNetwork, osrfSetNetworkHandle from osrf.stack import osrfPushStack from osrf.log import * @@ -21,28 +21,31 @@ from osrf.set import osrfLoadSettings import sys -def osrfConnect(configFile): - """ Connects to the opensrf network """ - - # parse the config file - configParser = osrfConfig(configFile) - configParser.parseConfig() - - # set up logging - osrfInitLog(osrfConfigValue('loglevel'), osrfConfigValue('syslog')) - - # connect to the opensrf network - network = osrfNetwork( - host=osrfConfigValue('domains.domain'), - port=osrfConfigValue('port'), - username=osrfConfigValue('username'), - password=osrfConfigValue('passwd')) - network.setRecvCallback(osrfPushStack) - osrfSetNetworkHandle(network) - network.connect() - - # load the domain-wide settings file - osrfLoadSettings(osrfConfigValue('domains.domain')) +def osrfConnect(configFile, configContext): + """ Connects to the opensrf network """ + + # parse the config file + configParser = osrfConfig(configFile, configContext) + configParser.parseConfig() + + # set up logging + osrfInitLog( + osrfConfigValue('loglevel'), + osrfConfigValueNoEx('syslog'), + osrfConfigValueNoEx('logfile')) + + # connect to the opensrf network + network = osrfNetwork( + host=osrfConfigValue('domains.domain'), + port=osrfConfigValue('port'), + username=osrfConfigValue('username'), + password=osrfConfigValue('passwd')) + network.setRecvCallback(osrfPushStack) + osrfSetNetworkHandle(network) + network.connect() + + # load the domain-wide settings file + osrfLoadSettings(osrfConfigValue('domains.domain')) diff --git a/src/python/osrf/utils.py b/src/python/osrf/utils.py index fe637f1..6b20675 100644 --- a/src/python/osrf/utils.py +++ b/src/python/osrf/utils.py @@ -3,14 +3,14 @@ import xml.dom.minidom, re def osrfXMLFileToObject(filename): """Turns the contents of an XML file into a Python object""" doc = xml.dom.minidom.parse(filename) - obj = osrfXMLNodeToObject(doc.childNodes[0]) + obj = osrfXMLNodeToObject(doc.documentElement) doc.unlink() return obj def osrfXMLStringToObject(string): """Turns an XML string into a Python object""" doc = xml.dom.minidom.parseString(string) - obj = osrfXMLNodeToObject(doc.childNodes[0]) + obj = osrfXMLNodeToObject(doc.documentElement) doc.unlink() return obj @@ -72,7 +72,7 @@ def osrfObjectFindPath(obj, path, idx=None): parts = [] - if re.compile('/').search(path): + if re.search('/', path): parts = path.split('/') else: parts = path.split('.') diff --git a/src/python/srfsh.py b/src/python/srfsh.py index 4742246..70a278e 100755 --- a/src/python/srfsh.py +++ b/src/python/srfsh.py @@ -214,9 +214,8 @@ def setup_readline(): def do_connect(): file = os.path.join(get_var('HOME'), ".srfsh.xml") - print_green("Connecting to opensrf...") - osrfConnect(file) + osrfConnect(file, 'srfsh') print_red('OK\n') def load_plugins():