# HG changeset patch # User Paul Boddie # Date 1223832510 -7200 # Node ID 54380c79216ee5315ad9d5f4cd0ab2aa860193f6 # Parent a333f8d849e82c6350e61774742713563b2887a8 Introduced set usage in order to improve efficiency. diff -r a333f8d849e8 -r 54380c79216e XSLForms/Output.py --- a/XSLForms/Output.py Sat Oct 11 23:11:02 2008 +0200 +++ b/XSLForms/Output.py Sun Oct 12 19:28:30 2008 +0200 @@ -29,6 +29,11 @@ from libxmlmods import libxml2mod from libxmlmods import libxsltmod +try: + set +except NameError: + from sets import Set as set + import libxml2dom import urllib @@ -258,11 +263,10 @@ # NOTE: Could not directly reference attributes in the nodes list because # NOTE: libxml2dom did not yet support parent element discovery on # NOTE: attributes. The nodes function below remedies this. - names = [] + names = set() for node in nodes: name = path_to_node(libxml2dom.Node(node), 1, attribute_name, 0) - if name not in names: - names.append(name) + names.add(name) r = ",".join(names) return r.encode(libxml2_encoding) @@ -275,11 +279,10 @@ an XPath expression in the template. """ - names = [] + names = set() for node in nodes: name = path_to_node(libxml2dom.Node(node)) - if name not in names: - names.append(name) + names.add(name) r = ",".join(names) return r.encode(libxml2_encoding)