← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/bug-304 into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-304 into lp:openlp.

Requested reviews:
  Andreas Preikschat (googol)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/bug-304/+merge/85843

OpenLyrics  catches AttributeError and passes it on as Exception, which openlyricsimporter now can handle.
-- 
https://code.launchpad.net/~mahfiaz/openlp/bug-304/+merge/85843
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/lib/openlyricsimport.py'
--- openlp/plugins/songs/lib/openlyricsimport.py	2011-09-05 12:51:16 +0000
+++ openlp/plugins/songs/lib/openlyricsimport.py	2011-12-15 12:08:40 +0000
@@ -73,3 +73,6 @@
             except etree.XMLSyntaxError:
                 log.exception(u'XML syntax error in file %s' % file_path)
                 self.logError(file_path, SongStrings.XMLSyntaxError)
+            except Exception as values:
+                log.exception(u'%s in file %s' % (values[0], file_path))
+                self.logError(file_path, SongStrings.XMLSyntaxError)

=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py	2011-12-05 19:47:50 +0000
+++ openlp/plugins/songs/lib/xml.py	2011-12-15 12:08:40 +0000
@@ -673,9 +673,16 @@
         sxml = SongXML()
         verses = {}
         verse_def_list = []
-        lyrics = song_xml.lyrics
+        try:
+            lyrics = song_xml.lyrics
+        except AttributeError:
+            raise Exception('XML error, missing lyrics item')
+        try:
+            verses = lyrics.verse
+        except AttributeError:
+            raise Exception('XML error, missing verse item')
         # Loop over the "verse" elements.
-        for verse in lyrics.verse:
+        for verse in verses:
             text = u''
             # Loop over the "lines" elements.
             for lines in verse.lines:


Follow ups