[open-ils-commits] r8222 - in trunk/Open-ILS/src/python/oils: . utils

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Dec 16 12:18:12 EST 2007


Author: dbs
Date: 2007-12-16 11:56:55 -0500 (Sun, 16 Dec 2007)
New Revision: 8222

Modified:
   trunk/Open-ILS/src/python/oils/system.py
   trunk/Open-ILS/src/python/oils/utils/csedit.py
   trunk/Open-ILS/src/python/oils/utils/idl.py
   trunk/Open-ILS/src/python/oils/utils/utils.py
Log:
Bring Evergreen Python code in sync with OpenSRF python.


Modified: trunk/Open-ILS/src/python/oils/system.py
===================================================================
--- trunk/Open-ILS/src/python/oils/system.py	2007-12-16 01:47:04 UTC (rev 8221)
+++ trunk/Open-ILS/src/python/oils/system.py	2007-12-16 16:56:55 UTC (rev 8222)
@@ -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()

Modified: trunk/Open-ILS/src/python/oils/utils/csedit.py
===================================================================
--- trunk/Open-ILS/src/python/oils/utils/csedit.py	2007-12-16 01:47:04 UTC (rev 8221)
+++ trunk/Open-ILS/src/python/oils/utils/csedit.py	2007-12-16 16:56:55 UTC (rev 8222)
@@ -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 @@
     # -------------------------------------------------------------------------
     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 @@
     # -------------------------------------------------------------------------
     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 @@
     # -------------------------------------------------------------------------
     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 @@
 
         # 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 @@
             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 @@
 
     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):

Modified: trunk/Open-ILS/src/python/oils/utils/idl.py
===================================================================
--- trunk/Open-ILS/src/python/oils/utils/idl.py	2007-12-16 01:47:04 UTC (rev 8221)
+++ trunk/Open-ILS/src/python/oils/utils/idl.py	2007-12-16 16:56:55 UTC (rev 8222)
@@ -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 @@
     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 @@
         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 @@
                         if classNode.nodeName == 'fields':
                             keys = self.parseFields(id, classNode)
 
-                osrfNetworkRegisterHint(id, keys, 'array')
+                NetworkRegisterHint(id, keys, 'array')
 
         doc.unlink()
 
@@ -95,7 +95,7 @@
                 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)

Modified: trunk/Open-ILS/src/python/oils/utils/utils.py
===================================================================
--- trunk/Open-ILS/src/python/oils/utils/utils.py	2007-12-16 01:47:04 UTC (rev 8221)
+++ trunk/Open-ILS/src/python/oils/utils/utils.py	2007-12-16 16:56:55 UTC (rev 8222)
@@ -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 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,



More information about the open-ils-commits mailing list