fixes for merge, catch another exception

This commit is contained in:
Andreas Preikschat 2011-01-20 06:42:27 +01:00
parent 57abf34057
commit 17d3ea7573
3 changed files with 9 additions and 9 deletions

View File

@ -313,7 +313,6 @@ class EasiSlidesImport(SongImport):
tag = SeqTypes[tag.lower()]
else:
continue
if tag in versetags:
self.verse_order_list.append(tag)
else:

View File

@ -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

View File

@ -279,13 +279,16 @@ class OpenLyrics(object):
# No xml get out of here.
if not xml:
return None
song = Song()
if xml[:5] == u'<?xml':
xml = xml[38:]
# Remove chords from xml.
xml = re.compile(u'<chord name=".*?"/>').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)