openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #21495
[Merge] lp:~trb143/openlp/202-2 into lp:openlp/2.0
Tim Bentley has proposed merging lp:~trb143/openlp/202-2 into lp:openlp/2.0.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1216044 in OpenLP: "Lyrics will be deleteted when saving a song"
https://bugs.launchpad.net/openlp/+bug/1216044
For more details, see:
https://code.launchpad.net/~trb143/openlp/202-2/+merge/181892
This is a fix to allow songs to save their lyrics as this was broken in r2159.
2.0.2 cannot be released without this.
--
https://code.launchpad.net/~trb143/openlp/202-2/+merge/181892
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/202-2 into lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2013-08-19 20:17:09 +0000
+++ openlp/plugins/songs/lib/xml.py 2013-08-23 18:49:26 +0000
@@ -78,16 +78,32 @@
NAMESPACE = u'http://openlyrics.info/namespace/2009/song'
NSMAP = '{' + NAMESPACE + '}' + '%s'
+
def clean_xml_string(xml):
"""
Filter out invalid characters in xml
Source <http://stackoverflow.com/questions/8733233/filtering-out-certain-bytes-in-python>
- """
- return ''.join(char for char in xml if
+
+ ``xml``
+ The actual text to be checked.
+
+ """
+ return ''.join(char for char in xml if valid_XML_char_ordinal(ord(char)))
+
+
+def valid_XML_char_ordinal(char):
+ """
+ Undertake the filter test.
+
+ ``char``
+ The individual character to be checked.
+ """
+ return (
0x20 <= char <= 0xD7FF
or char in (0x9, 0xA, 0xD)
or 0xE000 <= char <= 0xFFFD
- or 0x10000 <= char <= 0x10FFFF)
+ or 0x10000 <= char <= 0x10FFFF
+)
class SongXML(object):
Follow ups