forked from openlp/openlp
no xml raises XMLSyntaxError, that is why this is not needed
This commit is contained in:
parent
6baefdadce
commit
974a90a173
@ -128,9 +128,7 @@ class FoilPresenterImport(SongImport):
|
||||
try:
|
||||
parsed_file = etree.parse(file_path, parser)
|
||||
xml = unicode(etree.tostring(parsed_file))
|
||||
if self.FoilPresenter.xml_to_song(xml) is None:
|
||||
self.log_error(file_path, SongStrings.NoXML)
|
||||
log.debug(u'File could not be imported: %s' % file_path)
|
||||
self.FoilPresenter.xml_to_song(xml)
|
||||
except etree.XMLSyntaxError:
|
||||
self.log_error(file_path, SongStrings.XMLSyntaxError)
|
||||
log.exception(u'XML syntax error in file %s' % file_path)
|
||||
@ -213,7 +211,7 @@ class FoilPresenter(object):
|
||||
"""
|
||||
# No xml get out of here.
|
||||
if not xml:
|
||||
return None
|
||||
return
|
||||
if xml[:5] == u'<?xml':
|
||||
xml = xml[38:]
|
||||
song = Song()
|
||||
@ -237,7 +235,6 @@ class FoilPresenter(object):
|
||||
self._process_topics(foilpresenterfolie, song)
|
||||
clean_song(self.manager, song)
|
||||
self.manager.save_object(song)
|
||||
return song.id
|
||||
|
||||
def _child(self, element):
|
||||
"""
|
||||
|
@ -68,9 +68,7 @@ class OpenLyricsImport(SongImport):
|
||||
# special characters in the path (see lp:757673 and lp:744337).
|
||||
parsed_file = etree.parse(open(file_path, u'r'), 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)
|
||||
self.log_error(file_path, SongStrings.NoXML)
|
||||
self.openLyrics.xml_to_song(xml)
|
||||
except etree.XMLSyntaxError:
|
||||
log.exception(u'XML syntax error in file %s' % file_path)
|
||||
self.log_error(file_path, SongStrings.XMLSyntaxError)
|
||||
|
@ -38,7 +38,6 @@ class SongStrings(object):
|
||||
Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
|
||||
AuthorUnknown = u'Author Unknown' # Used to populate the database.
|
||||
CopyrightSymbol = translate('OpenLP.Ui', '\xa9', 'Copyright symbol.')
|
||||
NoXML = translate('OpenLP.Ui', 'Song does not contain any XML')
|
||||
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
|
||||
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
|
||||
SongIncomplete = translate('OpenLP.Ui','Title and/or verses not found')
|
||||
|
Loading…
Reference in New Issue
Block a user