Use the correct argument when adding service items remotely
- Fix #912 (closed) by using the correct argument
- Fix the tests on macOS (and now my machine) where some version of libxml2 has an error that causes syntax errors in the resulting XML.
Note on the XML issue:
When running TestOpenLyricsImport.test_can_parse_file_having_a_processing_instruction
I was consistently getting an XMLSyntaxError
. I traced it down to _process_verse_lines()
in OpenLyrics
where we converted an lxml.objectify
object to a string and parsed it via etree.XML()
(to de-objectify it).
For some reason, etree.tostring()
was generating a string with trailing XML tags that should not have been there:
<lines>Amazing grace how sweet the sound<br/>that saved a wretch like me;</lines></verse></lyrics></song>
I installed both earlier and the most current versions of lxml
in a virtual environment and they all worked fine, but as soon as I went back to lxml
4.6.3 with whatever system wide version of libxml2
that I have, it would do that again. I tested this both with the tests (running pytest
inside and outside my virtual environment), as well as in OpenLP with a proper import.
This is also happening on macOS (as can be seen with the tests that are failing), so it points toward some particular combination of lxml
and libxml2
. The easiest way around this was to just remove those extra closing tags before re-parsing the XML string.