Improve configclass debug output a little, and be safer about a variable that might not exist

This commit is contained in:
Chris Jones 2008-04-07 21:49:10 +01:00
parent 65cb27c2bb
commit 4991b0ae21
1 changed files with 12 additions and 11 deletions

View File

@ -58,16 +58,16 @@ class TerminatorConfig:
self.sources.append (source)
def __getattr__ (self, keyname):
dbg ("Config: Looking for: %s"%keyname)
dbg ("TConfig: Looking for: '%s'"%keyname)
for source in self.sources:
try:
val = getattr (source, keyname)
dbg ("Config: got: %s from a %s"%(val, source.type))
dbg (" TConfig: got: '%s' from a '%s'"%(val, source.type))
return (val)
except:
dbg ("Config: no value found in %s."%source.type)
dbg (" TConfig: no value found in '%s'."%source.type)
pass
dbg ("Config: Out of sources")
dbg (" TConfig: Out of sources")
raise (AttributeError)
class TerminatorConfValuestore:
@ -185,7 +185,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
# FIXME: Do we need to watch more non-profile stuff here?
def set_reconfigure_callback (self, function):
dbg ("Config: setting callback to: %s"%function)
dbg (" VSConf: setting callback to: %s"%function)
self.reconfigure_callback = function
return (True)
@ -196,6 +196,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
def __getattr__ (self, key = ""):
ret = None
value = None
dbg (' VSGConf: preparing: %s/%s'%(self.profile, key))
@ -204,7 +205,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
value = self.client.get ('/desktop/gnome/interface/monospace_font_name')
else:
value = self.client.get ('%s/%s'%(self.profile, key))
dbg ('VSGConf: getting: %s'%value)
if value:
funcname = "get_" + self.defaults[key][0].__name__
# Special case for str