# Copyright 2004-2005 James Bunton <james@delx.cjb.net>
# Licensed for distribution under the GPL version 2, check COPYING for details
+from twisted.python import log
+
checkTwistedCached = None
def checkTwisted():
""" Returns False if we're using an old version that needs tlib, otherwise returns True """
try:
+ log.msg("Trying to import XML DOM")
from twisted.words.xish.domish import SuxElementStream, Element
+ log.msg("Using Twisted >= 2.0, Words >= 0.3, Words DOM")
except ImportError:
try:
+ log.msg("Checking Twisted version...")
if checkTwisted():
from twisted.xish.domish import SuxElementStream, Element
+ log.msg("Using Twisted >= 2.0, Words < 0.3, Twisted DOM")
else:
from tlib.domish import SuxElementStream, Element
+ log.msg("Using Twisted < 2.0, Internal patched DOM")
except ImportError:
print "Could not find the XML DOM. If you're using Twisted 2.x make sure you have twisted.words installed."
raise