From 17d3ea7573be7287589f78a8b66e1d624d510fdf Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 20 Jan 2011 06:42:27 +0100 Subject: [PATCH] fixes for merge, catch another exception --- openlp/plugins/songs/lib/easislidesimport.py | 1 - openlp/plugins/songs/lib/openlyricsimport.py | 10 ++++------ openlp/plugins/songs/lib/xml.py | 7 +++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 85384efd7..316b78d8c 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -313,7 +313,6 @@ class EasiSlidesImport(SongImport): tag = SeqTypes[tag.lower()] else: continue - if tag in versetags: self.verse_order_list.append(tag) else: diff --git a/openlp/plugins/songs/lib/openlyricsimport.py b/openlp/plugins/songs/lib/openlyricsimport.py index 60d032b7e..37407c75c 100644 --- a/openlp/plugins/songs/lib/openlyricsimport.py +++ b/openlp/plugins/songs/lib/openlyricsimport.py @@ -70,11 +70,9 @@ class OpenLyricsImport(SongImport): os.path.basename(file_path)) try: parsed_file = etree.parse(file_path, parser) + xml = unicode(etree.tostring(parsed_file)) + if self.openLyrics.xml_to_song(xml) is None: + log.debug(u'File could not be imported: %s' % file_path) except etree.XMLSyntaxError: - return False - xml = unicode(etree.tostring(parsed_file)) - if self.openLyrics.xml_to_song(xml) is None: - log.debug(u'File could not be imported: %s' % file_path) - # Importing this song failed! For now we stop import. - return False + log.exception(u'XML syntax error in file %s' % file_path) return True diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 7fc102e81..91bfdb025 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -279,13 +279,16 @@ class OpenLyrics(object): # No xml get out of here. if not xml: return None - song = Song() if xml[:5] == u'').sub(u'', xml) song_xml = objectify.fromstring(xml) - properties = song_xml.properties + try: + properties = song_xml.properties + except AttributeError: + return None + song = Song() self._process_copyright(properties, song) self._process_cclinumber(properties, song) self._process_titles(properties, song)