From: <dg...@us...> - 2010-05-05 17:06:21
|
Revision: 575 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=575&view=rev Author: dgranda Date: 2010-05-05 17:06:15 +0000 (Wed, 05 May 2010) Log Message: ----------- Converting bytes into string to allow extended characters - encoded in utf-8 - to be written to xml file Modified Paths: -------------- pytrainer/trunk/pytrainer/profile.py Modified: pytrainer/trunk/pytrainer/profile.py =================================================================== --- pytrainer/trunk/pytrainer/profile.py 2010-05-02 10:20:25 UTC (rev 574) +++ pytrainer/trunk/pytrainer/profile.py 2010-05-05 17:06:15 UTC (rev 575) @@ -153,7 +153,7 @@ else: logging.debug("Attempting to parse content from "+ config_file) try: - parser = etree.XMLParser(encoding='UTF8') + parser = etree.XMLParser(encoding='UTF8', recover=True) self.xml_tree = etree.parse(config_file, parser=parser) #TODO check here for empty file.... # Checks if configuration file is empty @@ -195,7 +195,7 @@ if tag != "pytraining": print "ERROR - pytraining is the only profile tag supported" logging.debug("Setting %s to %s" % (variable, value)) - self.xml_tree.getroot().set(variable, value) + self.xml_tree.getroot().set(variable, value.decode('utf-8')) if not delay_write: logging.debug("Writting...") self.xml_tree.write(self.config_file, xml_declaration=True) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |