Package: python-turbogears
Version: 1.0.2.2-1
Severity: normal
Tags: patch

Hi,

turbogears uses elementtree. As elementtree was included in python2.5
the python-elementtree doesn't support python2.5. Therefore the imports
in turbogears needs to be fixed to import the correct module when
running with python2.5.

I've filed upstream a bug report about it:
http://trac.turbogears.org/ticket/1441
The attached patch tries to import xml.etree first and fall-backs to
importing elementtree. It was applied into upstream svn as rev3262:
http://trac.turbogears.org/changeset/3262

Michael
Index: turbogears/command/i18n.py
===================================================================
--- turbogears/command/i18n.py	(revision 3250)
+++ turbogears/command/i18n.py	(working copy)
@@ -10,7 +10,12 @@
 import optparse
 import tempfile
 
-from elementtree.ElementTree import ElementTree
+try:
+    # try the python 2.5 way
+    from xml.etree.cElementTree import ElementTree, XML
+except ImportError:
+    # then try the python 2.4 way
+    from elementtree.ElementTree import ElementTree
 
 import formencode
 import turbogears
Index: turbogears/toolbox/admi18n/pygettext.py
===================================================================
--- turbogears/toolbox/admi18n/pygettext.py	(revision 3250)
+++ turbogears/toolbox/admi18n/pygettext.py	(working copy)
@@ -169,7 +169,13 @@
 import operator
 import codecs
 
-from elementtree.ElementTree import ElementTree, XML
+try:
+    # try the python 2.5 way
+    from xml.etree.cElementTree import ElementTree, XML
+except ImportError:
+    # then try the python 2.4 way
+    from elementtree.ElementTree import ElementTree, XML
+
 from turbogears.util import fixentities
 
 __version__ = '1.5'

Reply via email to