Fixed an issue in the FoilPresenter importer when songs with no titles are imported

bzr-revno: 2033
Fixes: https://launchpad.net/bugs/1015524
This commit is contained in:
Philip Ridout 2012-07-20 09:31:31 +02:00 committed by Raoul Snyman
commit a8b870e3d9

View File

@ -483,8 +483,11 @@ class FoilPresenter(object):
# Process verse order # Process verse order
verse_order = [] verse_order = []
verse_strophenr = [] verse_strophenr = []
try:
for strophennummer in foilpresenterfolie.reihenfolge.strophennummer: for strophennummer in foilpresenterfolie.reihenfolge.strophennummer:
verse_strophenr.append(strophennummer) verse_strophenr.append(strophennummer)
except AttributeError:
pass
# Currently we do not support different "parts"! # Currently we do not support different "parts"!
if u'0' in temp_verse_order: if u'0' in temp_verse_order:
for vers in temp_verse_order_backup: for vers in temp_verse_order_backup:
@ -538,12 +541,17 @@ class FoilPresenter(object):
``song`` ``song``
The song object. The song object.
""" """
try:
for title_string in foilpresenterfolie.titel.titelstring: for title_string in foilpresenterfolie.titel.titelstring:
if not song.title: if not song.title:
song.title = self._child(title_string) song.title = self._child(title_string)
song.alternate_title = u'' song.alternate_title = u''
else: else:
song.alternate_title = self._child(title_string) song.alternate_title = self._child(title_string)
except AttributeError:
# Use first line of first verse
first_line = self._child(foilpresenterfolie.strophen.strophe.text_)
song.title = first_line.split('\n')[0]
def _process_topics(self, foilpresenterfolie, song): def _process_topics(self, foilpresenterfolie, song):
""" """