forked from openlp/openlp
Name it rather OpenLyricsError
This commit is contained in:
parent
28fa03b7cd
commit
86df7d9734
@ -38,7 +38,7 @@ from openlp.core.ui.wizard import WizardStrings
|
|||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib import OpenLyrics
|
from openlp.plugins.songs.lib import OpenLyrics
|
||||||
from openlp.plugins.songs.lib.xml import OpenLyricsException
|
from openlp.plugins.songs.lib.xml import OpenLyricsError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class OpenLyricsImport(SongImport):
|
|||||||
except etree.XMLSyntaxError:
|
except etree.XMLSyntaxError:
|
||||||
log.exception(u'XML syntax error in file %s' % file_path)
|
log.exception(u'XML syntax error in file %s' % file_path)
|
||||||
self.logError(file_path, SongStrings.XMLSyntaxError)
|
self.logError(file_path, SongStrings.XMLSyntaxError)
|
||||||
except OpenLyricsException as exception:
|
except OpenLyricsError as exception:
|
||||||
log.exception(u'OpenLyricsException of type %s: %s in file %s'
|
log.exception(u'OpenLyricsException of type %s: %s in file %s'
|
||||||
% (exception.type, exception.message, file_path))
|
% (exception.type, exception.message, file_path))
|
||||||
if exception.type is 'XML':
|
if exception.type is 'XML':
|
||||||
|
@ -676,11 +676,11 @@ class OpenLyrics(object):
|
|||||||
try:
|
try:
|
||||||
lyrics = song_xml.lyrics
|
lyrics = song_xml.lyrics
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise OpenLyricsException('XML', 'missing lyrics item')
|
raise OpenLyricsError('XML', 'missing lyrics item')
|
||||||
try:
|
try:
|
||||||
verses = lyrics.verse
|
verses = lyrics.verse
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise OpenLyricsException('XML', 'missing verse item')
|
raise OpenLyricsError('XML', 'missing verse item')
|
||||||
# Loop over the "verse" elements.
|
# Loop over the "verse" elements.
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
text = u''
|
text = u''
|
||||||
@ -800,7 +800,7 @@ class OpenLyrics(object):
|
|||||||
xml_declaration=True, pretty_print=True)
|
xml_declaration=True, pretty_print=True)
|
||||||
|
|
||||||
|
|
||||||
class OpenLyricsException(Exception):
|
class OpenLyricsError(Exception):
|
||||||
"""
|
"""
|
||||||
By now raised only in case of missing lyrics or verse element in XML.
|
By now raised only in case of missing lyrics or verse element in XML.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user