[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/etree.py Report meaningful error when PDIS-XPath library is missing.

Malthe Borch mborch at gmail.com
Mon Oct 27 04:42:45 EDT 2008


Log message for revision 92610:
  Report meaningful error when PDIS-XPath library is missing.

Changed:
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/etree.py

-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/etree.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/etree.py	2008-10-27 05:39:26 UTC (rev 92609)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/etree.py	2008-10-27 08:42:44 UTC (rev 92610)
@@ -55,7 +55,7 @@
 
 try:
     import lxml.etree
-
+    
     class ElementBase(lxml.etree.ElementBase):
         def tostring(self):
             return lxml.etree.tostring(self)
@@ -208,7 +208,11 @@
 
 except ImportError:
     ET = import_elementtree()
-    from pdis.xpath import XPath
+
+    try:
+        from pdis.xpath import XPath
+    except ImportError:
+        raise ImportError("PDIS-XPath is required when lxml is unavailable.")
     
     class ElementBase(object, ET._ElementInterface):
         _parent = None



More information about the Checkins mailing list