From b21f3484cb552836b20ada3f381f4bc602569834 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 23 Jul 2015 10:14:16 +0300 Subject: [PATCH] Fix problem with unicode symbols in path to home directory --- bin/launchConfigureParser.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 39c3d22cb..82ab8e651 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -312,6 +312,15 @@ class xml_parser: return string.atoi(strloc) return strloc pass + + def strValue( self, str ): + strloc = str + try: + if isinstance(strloc, types.UnicodeType): strloc = strloc.encode().strip() + else: strloc = strloc.strip() + except: + pass + return strloc def startElement(self, name, attrs): self.space.append(name) @@ -347,14 +356,15 @@ class xml_parser: key = nam else: # key for section key = self.section + "_" + nam + key = self.strValue( key ) if nam in boolKeys: self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1 elif nam in intKeys: self.opts[key] = self.intValue( val ) # assign integer value elif nam in listKeys: - self.opts[key] = filter( lambda a: a.strip(), re.split( "[:;,]", val ) ) # assign list value: [] + self.opts[key] = [ self.strValue( a ) for a in re.split( "[:;,]", val ) ] # assign list value: [] else: - self.opts[key] = val + self.opts[key] = self.strValue( val ) # string value pass pass -- 2.39.2