From 98a9550f2f93ee41696d50fc7b6c5cd89a93b7da Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Fri, 23 May 2008 11:42:04 +0100 Subject: [PATCH] Handle "foo = bar" as well as "foo=bar" --- terminatorlib/config.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 9917896c..6d32b29b 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -32,7 +32,7 @@ AttributeError. This is by design. If you want to look something up, set a default for it first.""" # import standard python libs -import os, sys +import os, sys, re # import unix-lib import pwd @@ -129,6 +129,7 @@ class TerminatorConfValuestoreDefault (TerminatorConfValuestore): class TerminatorConfValuestoreRC (TerminatorConfValuestore): rcfilename = "" + splitter = re.compile("\s*=\s*") #FIXME: use inotify to watch the rc, split __init__ into a parsing function # that can be re-used when rc changes. def __init__ (self): @@ -143,7 +144,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): try: item = item.strip () if item and item[0] != '#': - (key, value) = item.split ("=") + (key, value) = self.splitter.split (item) if value == 'True': self.values[key] = True elif value == 'False': @@ -151,8 +152,8 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): else: self.values[key] = value dbg (" VS_RCFile: Set value '%s' to '%s'"%(key, self.values[key])) - except: - dbg (" VS_RCFile: Exception handling: %s"%item) + except Exception, e: + dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), item)) pass class TerminatorConfValuestoreGConf (TerminatorConfValuestore):