aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
authorArtem Yunusov <nedrlab@gmail.com>2008-08-08 03:43:56 +0500
committerArtem Yunusov <nedrlab@gmail.com>2008-08-08 03:43:56 +0500
commit58d96ea769135a090a70eb322e536c544ee29c81 (patch)
tree7270568539e897bc2e5df2225b3a156285cb9e7d /markdown.py
parent13f2bf66a5683aafc6c124af3585b4989042b301 (diff)
downloadmarkdown-58d96ea769135a090a70eb322e536c544ee29c81.tar.gz
markdown-58d96ea769135a090a70eb322e536c544ee29c81.tar.bz2
markdown-58d96ea769135a090a70eb322e536c544ee29c81.zip
ElementTree version check added.
Diffstat (limited to 'markdown.py')
-rwxr-xr-xmarkdown.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/markdown.py b/markdown.py
index df85bab..a39a99c 100755
--- a/markdown.py
+++ b/markdown.py
@@ -58,10 +58,10 @@ def isstr(s):
def importETree():
""" Imports best variant of ElementTree
and returns module object """
-
+ cetree = None
try:
# Python 2.5+
- import xml.etree.cElementTree as etree
+ import xml.etree.cElementTree as cetree
except ImportError:
try:
# Python 2.5+
@@ -69,7 +69,7 @@ def importETree():
except ImportError:
try:
# normal cElementTree install
- import cElementTree as etree
+ import cElementTree as cetree
except ImportError:
try:
# normal ElementTree install
@@ -78,6 +78,19 @@ def importETree():
message(CRITICAL,
"Failed to import ElementTree from any known place")
sys.exit(1)
+ if cetree:
+ if cetree.VERSION < "1.0":
+ message(CRITICAL,
+ "cElementTree version is too old, 1.0 and upper required")
+ sys.exit(1)
+
+ etree = cetree
+ else:
+ if etree.VERSION < "1.1":
+ message(CRITICAL,
+ "ElementTree version is too old, 1.1 and upper required")
+ sys.exit(1)
+
return etree
etree = importETree()