From 1b3a15695fff6ee30d67a218c44679e423a478e4 Mon Sep 17 00:00:00 2001 From: dbs Date: Sun, 16 Dec 2007 16:56:55 +0000 Subject: [PATCH] Bring Evergreen Python code in sync with OpenSRF python. git-svn-id: svn://svn.open-ils.org/ILS/trunk@8222 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/python/oils/system.py | 8 ++++---- Open-ILS/src/python/oils/utils/csedit.py | 20 ++++++++++---------- Open-ILS/src/python/oils/utils/idl.py | 14 +++++++------- Open-ILS/src/python/oils/utils/utils.py | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Open-ILS/src/python/oils/system.py b/Open-ILS/src/python/oils/system.py index 5f587afdc5..73e310776c 100644 --- a/Open-ILS/src/python/oils/system.py +++ b/Open-ILS/src/python/oils/system.py @@ -13,14 +13,14 @@ # GNU General Public License for more details. # ----------------------------------------------------------------------- -from osrf.log import * -from osrf.system import osrfConnect +import osrf.log +from osrf.system import connect from oils.utils.idl import oilsParseIDL from oils.utils.csedit import oilsLoadCSEditor def oilsConnect(config, configContext): """Connects to the opensrf network, parses the IDL file, and loads the CSEditor""" - osrfLogInfo("oilsConnect(): connecting with config %s" % config) - osrfConnect(config, configContext) + osrf.log.log_info("oilsConnect(): connecting with config %s" % config) + connect(config, configContext) oilsParseIDL() oilsLoadCSEditor() diff --git a/Open-ILS/src/python/oils/utils/csedit.py b/Open-ILS/src/python/oils/utils/csedit.py index 174eb48233..281cb473a7 100644 --- a/Open-ILS/src/python/oils/utils/csedit.py +++ b/Open-ILS/src/python/oils/utils/csedit.py @@ -16,7 +16,7 @@ from osrf.log import * from osrf.json import * from oils.utils.idl import oilsGetIDLParser -from osrf.ses import osrfClientSession +from osrf.ses import ClientSession from oils.const import * import re @@ -44,14 +44,14 @@ class CSEditor(object): # ------------------------------------------------------------------------- def session(self, ses=None): if not self.__session: - self.__session = osrfClientSession(self.app) + self.__session = ClientSession(self.app) if self.connect or self.xact: - self.log(osrfLogDebug,'connecting to ' + self.app) + self.log(log_debug,'connecting to ' + self.app) self.__session.connect() if self.xact: - self.log(osrfLogInfo, "starting new db transaction") + self.log(log_info, "starting new db transaction") self.request(self.app + '.transaction.begin') return self.__session @@ -75,7 +75,7 @@ class CSEditor(object): # ------------------------------------------------------------------------- def rollback(self): if self.__session and self.xact: - self.log(osrfLogInfo, "rolling back db transaction") + self.log(log_info, "rolling back db transaction") self.request(self.app + '.transaction.rollback') self.disconnect() @@ -84,7 +84,7 @@ class CSEditor(object): # ------------------------------------------------------------------------- def commit(self): if self.__session and self.xact: - self.log(osrfLogInfo, "comitting db transaction") + self.log(log_info, "comitting db transaction") self.request(self.app + '.transaction.commit') self.disconnect() @@ -105,10 +105,10 @@ class CSEditor(object): # XXX improve param logging here - self.log(osrfLogInfo, "request %s %s" % (method, str(params))) + self.log(log_info, "request %s %s" % (method, str(params))) if self.xact and self.session().state != OSRF_APP_SESSION_CONNECTED: - self.log(osrfLogErr, "csedit lost its connection!") + self.log(log_error, "csedit lost its connection!") val = None @@ -118,7 +118,7 @@ class CSEditor(object): val = resp.content() except Exception, e: - self.log(osrfLogErr, "request error: %s" % str(e)) + self.log(log_error, "request error: %s" % str(e)) raise e return val @@ -158,7 +158,7 @@ class CSEditor(object): def rawSearch(self, args): method = "%s.json_query.atomic" % self.app - self.log(osrfLogDebug, "rawSearch args: %s" % str(args)) + self.log(log_debug, "rawSearch args: %s" % str(args)) return self.request(method, [args]) def rawSearch2(self, hint, fields, where, from_=None): diff --git a/Open-ILS/src/python/oils/utils/idl.py b/Open-ILS/src/python/oils/utils/idl.py index 2ef7c8a102..8ab9bf69e9 100644 --- a/Open-ILS/src/python/oils/utils/idl.py +++ b/Open-ILS/src/python/oils/utils/idl.py @@ -1,6 +1,6 @@ -from osrf.net_obj import osrfNetworkRegisterHint -from osrf.log import * -from osrf.set import osrfSettingsValue +from osrf.net_obj import NetworkRegisterHint +import osrf.log +import osrf.set import sys, string, xml.dom.minidom from oils.const import OILS_NS_OBJ, OILS_NS_PERSIST, OILS_NS_REPORTER @@ -11,7 +11,7 @@ def oilsParseIDL(): global __global_parser if __global_parser: return # no need to re-parse the IDL idlParser = oilsIDLParser(); - idlParser.setIDL(osrfSettingsValue('IDL')) + idlParser.setIDL(osrf.set.get('IDL')) idlParser.parseIDL() __global_parser = idlParser @@ -25,7 +25,7 @@ class oilsIDLParser(object): self.IDLObject = {} def setIDL(self, file): - osrfLogInfo("setting IDL file to " + str(file)) + osrf.log.log_info("setting IDL file to " + str(file)) self.idlFile = file def __getAttr(self, node, name, ns=None): @@ -70,7 +70,7 @@ class oilsIDLParser(object): if classNode.nodeName == 'fields': keys = self.parseFields(id, classNode) - osrfNetworkRegisterHint(id, keys, 'array') + NetworkRegisterHint(id, keys, 'array') doc.unlink() @@ -95,7 +95,7 @@ class oilsIDLParser(object): try: keys[position] = name except Exception, e: - osrfLogErr("parseFields(): position out of range. pos=%d : key-size=%d" % (position, len(keys))) + osrf.log.log_error("parseFields(): position out of range. pos=%d : key-size=%d" % (position, len(keys))) raise e virtual = self.__getAttr(field, 'oils_persist:virtual', OILS_NS_PERSIST) diff --git a/Open-ILS/src/python/oils/utils/utils.py b/Open-ILS/src/python/oils/utils/utils.py index 42d6e890c9..4735a9f02c 100644 --- a/Open-ILS/src/python/oils/utils/utils.py +++ b/Open-ILS/src/python/oils/utils/utils.py @@ -14,7 +14,7 @@ # ----------------------------------------------------------------------- import re, md5 -from osrf.ses import osrfAtomicRequest +from osrf.ses import AtomicRequest from osrf.log import * @@ -53,16 +53,16 @@ def unique(arr): def login(username, password, type=None, workstation=None): ''' Login to the server and get back an authtoken''' - osrfLogInfo("attempting login with user " + username) + log_info("attempting login with user " + username) - seed = osrfAtomicRequest( + seed = AtomicRequest( 'open-ils.auth', 'open-ils.auth.authenticate.init', username) # generate the hashed password password = md5sum(seed + md5sum(password)) - return osrfAtomicRequest( + return AtomicRequest( 'open-ils.auth', 'open-ils.auth.authenticate.complete', { 'workstation' : workstation, -- 2.11.0