1.1 --- a/XSLForms/Output.py Sat Oct 11 23:11:02 2008 +0200
1.2 +++ b/XSLForms/Output.py Sun Oct 12 19:28:30 2008 +0200
1.3 @@ -29,6 +29,11 @@
1.4 from libxmlmods import libxml2mod
1.5 from libxmlmods import libxsltmod
1.6
1.7 +try:
1.8 + set
1.9 +except NameError:
1.10 + from sets import Set as set
1.11 +
1.12 import libxml2dom
1.13 import urllib
1.14
1.15 @@ -258,11 +263,10 @@
1.16 # NOTE: Could not directly reference attributes in the nodes list because
1.17 # NOTE: libxml2dom did not yet support parent element discovery on
1.18 # NOTE: attributes. The nodes function below remedies this.
1.19 - names = []
1.20 + names = set()
1.21 for node in nodes:
1.22 name = path_to_node(libxml2dom.Node(node), 1, attribute_name, 0)
1.23 - if name not in names:
1.24 - names.append(name)
1.25 + names.add(name)
1.26 r = ",".join(names)
1.27 return r.encode(libxml2_encoding)
1.28
1.29 @@ -275,11 +279,10 @@
1.30 an XPath expression in the template.
1.31 """
1.32
1.33 - names = []
1.34 + names = set()
1.35 for node in nodes:
1.36 name = path_to_node(libxml2dom.Node(node))
1.37 - if name not in names:
1.38 - names.append(name)
1.39 + names.add(name)
1.40 r = ",".join(names)
1.41 return r.encode(libxml2_encoding)
1.42