use datatypes in parsing of RC files, so non-string/bool values actually work
This commit is contained in:
parent
e55d78f277
commit
fa448d7925
|
@ -145,12 +145,29 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
||||||
item = item.strip ()
|
item = item.strip ()
|
||||||
if item and item[0] != '#':
|
if item and item[0] != '#':
|
||||||
(key, value) = self.splitter.split (item)
|
(key, value) = self.splitter.split (item)
|
||||||
if value.lower () == 'true':
|
|
||||||
self.values[key] = True
|
# Check if this is actually a key we care about
|
||||||
elif value.lower () == 'false':
|
if not self.defaults.has_key (key):
|
||||||
self.values[key] = False
|
raise AttributeError;
|
||||||
|
|
||||||
|
deftype = self.defaults[key].__class__.__name__
|
||||||
|
if deftype == 'bool':
|
||||||
|
if value.lower () == 'true':
|
||||||
|
self.values[key] = True
|
||||||
|
elif value.lower () == 'false':
|
||||||
|
self.values[key] = False
|
||||||
|
else:
|
||||||
|
raise AttributeError
|
||||||
|
elif deftype == 'int':
|
||||||
|
self.values[key] = int (value)
|
||||||
|
elif deftype == 'float':
|
||||||
|
self.values[key] = float (value)
|
||||||
|
elif deftype == 'list':
|
||||||
|
print >> sys.stderr, _("Reading list values from .terminatorrc is not currently supported")
|
||||||
|
raise ValueError
|
||||||
else:
|
else:
|
||||||
self.values[key] = value
|
self.values[key] = value
|
||||||
|
|
||||||
dbg (" VS_RCFile: Set value '%s' to '%s'"%(key, self.values[key]))
|
dbg (" VS_RCFile: Set value '%s' to '%s'"%(key, self.values[key]))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), item))
|
dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), item))
|
||||||
|
|
Loading…
Reference in New Issue