]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/python/osrf/set.py
removing some debug logging
[OpenSRF.git] / src / python / osrf / set.py
1 # -----------------------------------------------------------------------
2 # Copyright (C) 2007  Georgia Public Library Service
3 # Bill Erickson <billserickson@gmail.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 # -----------------------------------------------------------------------
15
16 from osrf.utils import *
17 from osrf.const import *
18 from osrf.ex import *
19
20 # global settings config object
21 __conifg = None
22
23 def osrfSettingsValue(path, idx=0):
24         global __config
25         val = osrfObjectFindPath(__config, path, idx)
26         if not val:
27                 raise osrfConfigException("Config value not found: " + path)
28         return val
29
30
31 def osrfLoadSettings(hostname):
32         global __config
33
34         from osrf.system import osrfConnect
35         from osrf.ses import osrfClientSession
36
37         ses = osrfClientSession(OSRF_APP_SETTINGS)
38         req = ses.request(OSRF_METHOD_GET_HOST_CONFIG, hostname)
39         resp = req.recv(timeout=30)
40         __config = resp.content()
41         req.cleanup()
42         ses.cleanup()
43