From da4060711a9d3f3da16d61ef5eb9f094c9728ac0 Mon Sep 17 00:00:00 2001 From: Carsten Tinggaard Date: Wed, 5 Nov 2008 19:35:24 +0000 Subject: [PATCH] Added import of types. Added UnicodeType in xml decoding Solved problem with danish song bzr-revno: 80 --- openlp/core/xmlrootclass.py | 7 +++++-- openlp/song/test/test_song_opensong.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/xmlrootclass.py b/openlp/core/xmlrootclass.py index 8131fb11e..982b0eb23 100644 --- a/openlp/core/xmlrootclass.py +++ b/openlp/core/xmlrootclass.py @@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import platform import sys import os +from types import StringType, NoneType, UnicodeType sys.path.append(os.path.abspath("./../..")) ver = platform.python_version() @@ -50,9 +51,11 @@ class XmlRootClass(object): if element.tag != rootTag: t=element.text #print element.tag, t, type(t) - if type(t) == type(None): # easy! + if type(t) == NoneType: # easy! val=t - if type(t) == type(" "): # strings need special handling to sort the colours out + elif type(t) == UnicodeType : + val=t + elif type(t) == StringType: # strings need special handling to sort the colours out #print "str", if t[0] == "$": # might be a hex number #print "hex", diff --git a/openlp/song/test/test_song_opensong.py b/openlp/song/test/test_song_opensong.py index 10cec81fc..bc88bcf8a 100644 --- a/openlp/song/test/test_song_opensong.py +++ b/openlp/song/test/test_song_opensong.py @@ -122,7 +122,7 @@ class Test_OpenSong(object): assert(s.GetVerseOrder() == "V1 C V2 C V3 C V4 C") assert(s.GetNumberOfSlides() == 5) - def atest_file3(self): + def test_file3(self): """OpenSong: parse 'På en fjern ensom høj' (danish)""" #FIXME: problem with XML convert and danish characters s = Song() @@ -137,5 +137,5 @@ class Test_OpenSong(object): if '__main__' == __name__: r = Test_OpenSong() - r.atest_file3() + r.test_file3()