Mercurial > libervia-backend
changeset 1456:a13be5c22334
xml_tools: minor attribute renaming
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 15 Aug 2015 22:27:39 +0200 |
parents | 4fb3280c4568 |
children | 2e43eb9d8167 |
files | src/tools/xml_tools.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tools/xml_tools.py Sat Aug 15 22:24:40 2015 +0200 +++ b/src/tools/xml_tools.py Sat Aug 15 22:27:39 2015 +0200 @@ -1105,10 +1105,10 @@ Found at http://stackoverflow.com/questions/2093400/how-to-create-twisted-words-xish-domish-element-entirely-from-raw-xml/2095942#2095942 (c) Karl Anderson""" - def __call__(self, string, force_spaces=False): + def __call__(self, raw_xml, force_spaces=False): """ - @param string: the XML string - @param force_spaces: if True, replace occurrences of 'n' and '\t' with ' '. + @param raw_xml(unicode): the raw XML + @param force_spaces: if True, replace occurrences of '\n' and '\t' with ' '. """ self.result = None @@ -1127,7 +1127,7 @@ parser.DocumentEndEvent = onEnd tmp = domish.Element((None, "s")) if force_spaces: - string = string.replace('\n', ' ').replace('\t', ' ') - tmp.addRawXml(string) + raw_xml = raw_xml.replace('\n', ' ').replace('\t', ' ') + tmp.addRawXml(raw_xml) parser.parse(tmp.toXml().encode('utf-8')) return self.result.firstChildElement()