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
verse_order = []
verse_strophenr = []
for strophennummer in foilpresenterfolie.reihenfolge.strophennummer:
verse_strophenr.append(strophennummer)
try:
for strophennummer in foilpresenterfolie.reihenfolge.strophennummer:
verse_strophenr.append(strophennummer)
except AttributeError:
pass
# Currently we do not support different "parts"!
if u'0' in temp_verse_order:
for vers in temp_verse_order_backup:
@ -538,12 +541,17 @@ class FoilPresenter(object):
``song``
The song object.
"""
for title_string in foilpresenterfolie.titel.titelstring:
if not song.title:
song.title = self._child(title_string)
song.alternate_title = u''
else:
song.alternate_title = self._child(title_string)
try:
for title_string in foilpresenterfolie.titel.titelstring:
if not song.title:
song.title = self._child(title_string)
song.alternate_title = u''
else:
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):
"""