Author: dmeyer
Date: Sun Jan 29 19:47:19 2006
New Revision: 7896
Modified:
trunk/core/src/conf.py
Log:
improve kaa.Config class for use with Freevo
Modified: trunk/core/src/conf.py
==============================================================================
--- trunk/core/src/conf.py (original)
+++ trunk/core/src/conf.py Sun Jan 29 19:47:19 2006
@@ -71,6 +71,30 @@
from kaa.base.strutils import to_unicode as Unicode
from kaa.base.strutils import to_str as String
from kaa.base.strutils import ENCODING
+from kaa.base.config import Var, Group, Dict, List
+from kaa.base.config import Config as KaaConfig
+
+class Config(KaaConfig):
+ def __init__(self, app, schema, desc=u'', name=''):
+ KaaConfig.__init__(self, schema, desc, name)
+ self._app = app
+
+ def load(self):
+ KaaConfig.load(self, '/etc/freevo/%s.conf' % self._app)
+ # if started as user add personal config file
+ if os.getuid() > 0:
+ cfgdir = os.path.expanduser('~/.freevo')
+ KaaConfig.load(self, os.path.join(cfgdir, '%s.conf' % self._app))
+
+ def _cfg_string(self, prefix, print_desc=True):
+ cfgfile = '/etc/freevo/%s.conf' % self._app
+ msg = ''
+ if os.getuid() > 0 and os.path.isfile(cfgfile):
+ msg = '#
*************************************************************\n'
+ msg += '# Please also check the system wide config file\n# %s\n' %
cfgfile
+ msg += '#
*************************************************************\n\n'
+ return msg + KaaConfig._cfg_string(self, prefix, print_desc)
+
# set basic env variables
if not os.environ.has_key('HOME') or not os.environ['HOME'] or
os.environ['HOME'] == '/':
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog