# 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()
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
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()
# -------------------------------------------------------------------------
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()
# 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
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
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):
-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
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
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):
if classNode.nodeName == 'fields':
keys = self.parseFields(id, classNode)
- osrfNetworkRegisterHint(id, keys, 'array')
+ NetworkRegisterHint(id, keys, 'array')
doc.unlink()
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)
# -----------------------------------------------------------------------
import re, md5
-from osrf.ses import osrfAtomicRequest
+from osrf.ses import AtomicRequest
from osrf.log import *
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,