*** elementtree/ElementTree.py.orig Thu Apr 24 21:02:09 2008
--- elementtree/ElementTree.py Thu Apr 24 21:34:42 2008
***************
*** 1252,1254 ****
--- 1252,1267 ----
tree = self._target.close()
del self._target, self._parser # get rid of circular references
return tree
+
+ try:
+ from xml.parsers import expat
+ except ImportError:
+ import xmllib
+ import SimpleXMLTreeBuilder
+ def __init__fake(self, html=0):
+ self.__init__orig(html)
+ xmllib.XMLParser.__init__(self, accept_utf8=1)
+ clazz = SimpleXMLTreeBuilder.TreeBuilder
+ clazz.__init__orig = clazz.__init__
+ clazz.__init__ = __init__fake
+ XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder
ちなみにpatch当てなくても、ElementTree.pyの最下行に
try:
from xml.parsers import expat
except ImportError:
import xmllib
import SimpleXMLTreeBuilder
def __init__fake(self, html=0):
self.__init__orig(html)
xmllib.XMLParser.__init__(self, accept_utf8=1)
clazz = SimpleXMLTreeBuilder.TreeBuilder
clazz.__init__orig = clazz.__init__
clazz.__init__ = __init__fake
XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder
を足せば出来上がる。こうすると大概のものは小細工無しに動くと思う。たぶんエラーが出てたGoogle App Engineのサンプル、muvmuvのレビュービルド「http://localhost:8080/build」も問題なく通った。
良いやり方ではないですが...