# HG changeset patch # User Goffi # Date 1439670459 -7200 # Node ID a13be5c2233486b555203394a1582f57a6cc983b # Parent 4fb3280c4568a41d2ccf3426c4df7f4aeff437dc xml_tools: minor attribute renaming diff -r 4fb3280c4568 -r a13be5c22334 src/tools/xml_tools.py --- 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()