[patch] fix up elementtree imports

Martin Pool mbp at canonical.com
Sun Jun 11 04:23:52 BST 2006


Robert's recent change to monkey-patch elementtree breaks on systems
that use the shipped copy.  I think this fixes it.

-- 
Martin
-------------- next part --------------
=== modified file 'bzrlib/xml_serializer.py'
--- bzrlib/xml_serializer.py	2006-05-23 00:03:45 +0000
+++ bzrlib/xml_serializer.py	2006-06-11 03:20:42 +0000
@@ -27,12 +27,14 @@
 try:
     from cElementTree import (ElementTree, SubElement, Element,
                               XMLTreeBuilder, fromstring, tostring)
+    import elementtree
 except ImportError:
     mutter('WARNING: using slower ElementTree; consider installing cElementTree'
            " and make sure it's on your PYTHONPATH")
     from util.elementtree.ElementTree import (ElementTree, SubElement,
                                               Element, XMLTreeBuilder,
                                               fromstring, tostring)
+    import util.elementtree as elementtree
 
 from bzrlib.errors import BzrError
 
@@ -76,7 +78,6 @@
 # performance tuning for elementree's serialiser. THis should be
 # sent upstream - RBC 20060523.
 # the functions here are patched into elementree at runtime.
-import elementtree.ElementTree
 import re
 escape_re = re.compile("[&'\"<>]")
 escape_map = {



More information about the bazaar mailing list