openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #08392
[Merge] lp:~raoul-snyman/openlp/bug-771529 into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-771529 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #771529 in OpenLP: "Unable to import 1.9.0 databases"
https://bugs.launchpad.net/openlp/+bug/771529
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-771529/+merge/59439
Fixed bug #771529, dealing with 1.9.0 databases.
--
https://code.launchpad.net/~raoul-snyman/openlp/bug-771529/+merge/59439
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-771529 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py 2011-04-21 09:02:41 +0000
+++ openlp/plugins/songs/lib/__init__.py 2011-04-28 23:29:23 +0000
@@ -293,7 +293,10 @@
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
# Rebuild the verse order, to convert translated verse tags, which might
# have been added prior to 1.9.5.
- order = song.verse_order.strip().split()
+ if song.verse_order:
+ order = song.verse_order.strip().split()
+ else:
+ order = []
new_order = []
for verse_def in order:
verse_type = VerseType.Tags[VerseType.from_loose_input(verse_def[0])]
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2011-03-24 21:19:17 +0000
+++ openlp/plugins/songs/lib/xml.py 2011-04-28 23:29:23 +0000
@@ -133,14 +133,26 @@
[{'lang': 'en', 'type': 'c', 'label': '1'}, u"English chorus"]]
"""
self.song_xml = None
- if xml[:5] == u'<?xml':
+ verse_list = []
+ if not xml.startswith(u'<?xml') and not xml.startswith(u'<song'):
+ # This is an old style song, without XML. Let's handle it correctly
+ # by iterating through the verses, and then recreating the internal
+ # xml object as well.
+ self.song_xml = objectify.fromstring(u'<song version="1.0" />')
+ self.lyrics = etree.SubElement(self.song_xml, u'lyrics')
+ verses = xml.split(u'\n\n')
+ for count, verse in enumerate(verses):
+ verse_list.append([{u'type': u'v', u'label': unicode(count)},
+ unicode(verse)])
+ self.add_verse_to_lyrics(u'v', unicode(count), verse)
+ return verse_list
+ elif xml[:5] == u'<?xml':
xml = xml[38:]
try:
self.song_xml = objectify.fromstring(xml)
except etree.XMLSyntaxError:
log.exception(u'Invalid xml %s', xml)
xml_iter = self.song_xml.getiterator()
- verse_list = []
for element in xml_iter:
if element.tag == u'verse':
if element.text is None:
Follow ups