Formatting tags cause traceback

Bug #1621273 reported by Azaziah on 2016-09-07
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenLP
High
Tim Bentley

Bug Description

Adding formatting tag to a song and sending it to Live. Win 10 | trunk 2695

Traceback (most recent call last):
  File "E:\bzr\openlp\force-split\openlp\core\lib\mediamanageritem.py", line 466, in on_double_clicked
    self.on_live_click()
  File "E:\bzr\openlp\force-split\openlp\core\lib\mediamanageritem.py", line 507, in on_live_click
    self.go_live()
  File "E:\bzr\openlp\force-split\openlp\core\lib\mediamanageritem.py", line 528, in go_live
    service_item = self.build_service_item(item, remote=remote)
  File "E:\bzr\openlp\force-split\openlp\core\lib\mediamanageritem.py", line 626, in build_service_item
    if self.generate_slide_data(service_item, item, xml_version, remote, context):
  File "E:\bzr\openlp\force-split\openlp\plugins\songs\lib\mediaitem.py", line 611, in generate_slide_data
    service_item.xml_version = self.open_lyrics.song_to_xml(song)
  File "E:\bzr\openlp\force-split\openlp\plugins\songs\lib\openlyricsxml.py", line 322, in song_to_xml
    lines_element = self._add_text_with_tags_to_lines(verse_element, optional_verse, tags_element)
  File "E:\bzr\openlp\force-split\openlp\plugins\songs\lib\openlyricsxml.py", line 461, in _add_text_with_tags_to_lines
    text = text.replace('{/{tag}}}'.format(tag=tag), '</tag>')
ValueError: unexpected '{' in field name

Another traceback:

Traceback (most recent call last):
  File "E:\bzr\openlp\remove-escape-item\openlp\core\lib\mediamanageritem.py", line 466, in on_double_clicked
    self.on_live_click()
  File "E:\bzr\openlp\remove-escape-item\openlp\core\lib\mediamanageritem.py", line 508, in on_live_click
    self.go_live()
  File "E:\bzr\openlp\remove-escape-item\openlp\core\lib\mediamanageritem.py", line 529, in go_live
    service_item = self.build_service_item(item, remote=remote)
  File "E:\bzr\openlp\remove-escape-item\openlp\core\lib\mediamanageritem.py", line 627, in build_service_item
    if self.generate_slide_data(service_item, item, xml_version, remote, context):
  File "E:\bzr\openlp\remove-escape-item\openlp\plugins\songs\lib\mediaitem.py", line 611, in generate_slide_data
    service_item.xml_version = self.open_lyrics.song_to_xml(song)
  File "E:\bzr\openlp\remove-escape-item\openlp\plugins\songs\lib\openlyricsxml.py", line 322, in song_to_xml
    lines_element = self._add_text_with_tags_to_lines(verse_element, optional_verse, tags_element)
  File "E:\bzr\openlp\remove-escape-item\openlp\plugins\songs\lib\openlyricsxml.py", line 464, in _add_text_with_tags_to_lines
    element = etree.XML('<lines>{text}</lines>'.format(text=text))
  File "src\lxml\lxml.etree.pyx", line 3192, in lxml.etree.XML (src\lxml\lxml.etree.c:76452)
  File "src\lxml\parser.pxi", line 1830, in lxml.etree._parseMemoryDocument (src\lxml\lxml.etree.c:115104)
  File "src\lxml\parser.pxi", line 1711, in lxml.etree._parseDoc (src\lxml\lxml.etree.c:113680)
  File "src\lxml\parser.pxi", line 1051, in lxml.etree._BaseParser._parseUnicodeDoc (src\lxml\lxml.etree.c:107850)
  File "src\lxml\parser.pxi", line 584, in lxml.etree._ParserContext._handleParseResultDoc (src\lxml\lxml.etree.c:102153)
  File "src\lxml\parser.pxi", line 694, in lxml.etree._handleParseResult (src\lxml\lxml.etree.c:103803)
  File "src\lxml\parser.pxi", line 624, in lxml.etree._raiseParseError (src\lxml\lxml.etree.c:102715)
  File "<string>", line None
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: tag line 1 and lines, line 1, column 230

Related branches

Azaziah (suutari-olli) on 2016-09-12
description: updated
Azaziah (suutari-olli) on 2016-09-29
Changed in openlp:
importance: Undecided → High
Phill (phill-ridout) wrote :

Could not reproduce the first traceback, but it looks like the line in question has been modified since this report.

I can confirm the second traceback.

http://bazaar.launchpad.net/~openlp-core/openlp/trunk/view/head:/openlp/plugins/songs/lib/openlyricsxml.py#L461

in trunk:
    text = text.replace('{{{tag}}}'.format(tag=tag), '</tag>')

should be:
    text = text.replace('{{/{tag}}}'.format(tag=tag), '</tag>')

anybody feel free to have this as a freebie (im not in a position to fix it myself!)

Phill (phill-ridout) on 2016-10-21
Changed in openlp:
status: New → Confirmed
assignee: nobody → Phill (phill-ridout)
Phill (phill-ridout) on 2016-11-01
Changed in openlp:
assignee: Phill (phill-ridout) → Tim Bentley (trb143)
status: Confirmed → Fix Committed
milestone: none → 2.5.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers