summaryrefslogtreecommitdiff
path: root/openid/yadis
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2018-01-26 16:17:41 +0100
committerVlastimil Zíma <vlastimil.zima@nic.cz>2018-03-07 15:06:24 +0100
commitff6b54f3b66bcad8e3e9beaab9a7e6ab492fbf2a (patch)
treeb6e53d54986aa441d0c91c38ef66500d3ff41e69 /openid/yadis
parent6006ed0594ed4b120ae7999d75d4594f65fc1f1c (diff)
downloadopenid-ff6b54f3b66bcad8e3e9beaab9a7e6ab492fbf2a.tar.gz
Use lxml for XML
Diffstat (limited to 'openid/yadis')
-rw-r--r--openid/yadis/etxrd.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/openid/yadis/etxrd.py b/openid/yadis/etxrd.py
index 563a1f2..a536617 100644
--- a/openid/yadis/etxrd.py
+++ b/openid/yadis/etxrd.py
@@ -19,27 +19,12 @@ __all__ = [
]
import random
-import sys
from datetime import datetime
from time import strptime
-from openid.oidutil import importElementTree
-from openid.yadis import xri
-
-ElementTree = importElementTree()
+from lxml import etree as ElementTree
-# the different elementtree modules don't have a common exception
-# model. We just want to be able to catch the exceptions that signify
-# malformed XML data and wrap them, so that the other library code
-# doesn't have to know which XML library we're using.
-try:
- # Make the parser raise an exception so we can sniff out the type
- # of exceptions
- ElementTree.XML('> purposely malformed XML <')
-except (MemoryError, AssertionError, ImportError):
- raise
-except Exception:
- XMLError = sys.exc_info()[0]
+from openid.yadis import xri
class XRDSError(Exception):
@@ -65,7 +50,7 @@ def parseXRDS(text):
"""
try:
element = ElementTree.XML(text)
- except XMLError as why:
+ except ElementTree.Error as why:
exc = XRDSError('Error parsing document as XML')
exc.reason = why
raise exc