# HG changeset patch # User paulb # Date 1132942635 0 # Node ID bf67c1291e880ea08cdb9a04c3aa8de8b2691164 # Parent 6eb90658c00a0304257e2e15ff75d576999d735a [project @ 2005-11-25 18:17:15 by paulb] Added some tolerance for string inputs to the url-encode function. diff -r 6eb90658c00a -r bf67c1291e88 XSLForms/Output.py --- a/XSLForms/Output.py Thu Nov 24 16:53:05 2005 +0000 +++ b/XSLForms/Output.py Fri Nov 25 18:17:15 2005 +0000 @@ -326,10 +326,15 @@ in the optional 'charset' (UTF-8 if not specified). Note that / and # characters are replaced with their "URL encoded" character values. + If a string value is supplied for 'nodes', this will be translated instead. + template:url-encode(./text(), 'iso-8859-1') """ l = [] + if isinstance(nodes, str): + return urllib.quote(nodes.encode("utf-8")).replace("/", "%2F").replace("#", "%23") + for node in nodes: s = libxml2dom.Node(node).nodeValue l.append(urllib.quote(s.encode("utf-8")).replace("/", "%2F").replace("#", "%23"))