Handle "foo = bar" as well as "foo=bar"
This commit is contained in:
parent
12e7622c65
commit
98a9550f2f
|
@ -32,7 +32,7 @@ AttributeError. This is by design. If you want to look something
|
||||||
up, set a default for it first."""
|
up, set a default for it first."""
|
||||||
|
|
||||||
# import standard python libs
|
# import standard python libs
|
||||||
import os, sys
|
import os, sys, re
|
||||||
|
|
||||||
# import unix-lib
|
# import unix-lib
|
||||||
import pwd
|
import pwd
|
||||||
|
@ -129,6 +129,7 @@ class TerminatorConfValuestoreDefault (TerminatorConfValuestore):
|
||||||
|
|
||||||
class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
||||||
rcfilename = ""
|
rcfilename = ""
|
||||||
|
splitter = re.compile("\s*=\s*")
|
||||||
#FIXME: use inotify to watch the rc, split __init__ into a parsing function
|
#FIXME: use inotify to watch the rc, split __init__ into a parsing function
|
||||||
# that can be re-used when rc changes.
|
# that can be re-used when rc changes.
|
||||||
def __init__ (self):
|
def __init__ (self):
|
||||||
|
@ -143,7 +144,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
||||||
try:
|
try:
|
||||||
item = item.strip ()
|
item = item.strip ()
|
||||||
if item and item[0] != '#':
|
if item and item[0] != '#':
|
||||||
(key, value) = item.split ("=")
|
(key, value) = self.splitter.split (item)
|
||||||
if value == 'True':
|
if value == 'True':
|
||||||
self.values[key] = True
|
self.values[key] = True
|
||||||
elif value == 'False':
|
elif value == 'False':
|
||||||
|
@ -151,8 +152,8 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
||||||
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:
|
except Exception, e:
|
||||||
dbg (" VS_RCFile: Exception handling: %s"%item)
|
dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), item))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
|
class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
|
||||||
|
|
Loading…
Reference in New Issue