[Checkins] SVN: zope.etree/trunk/src/zope/etree/ Add support for the cElementTree module.

Michael Kerrin michael.kerrin at openapp.biz
Sun Aug 27 06:17:55 EDT 2006


Log message for revision 69789:
  Add support for the cElementTree module.
  

Changed:
  U   zope.etree/trunk/src/zope/etree/etree.py
  U   zope.etree/trunk/src/zope/etree/tests.py
  U   zope.etree/trunk/src/zope/etree/zope.etree-configure.zcml

-=-
Modified: zope.etree/trunk/src/zope/etree/etree.py
===================================================================
--- zope.etree/trunk/src/zope/etree/etree.py	2006-08-27 10:09:59 UTC (rev 69788)
+++ zope.etree/trunk/src/zope/etree/etree.py	2006-08-27 10:17:52 UTC (rev 69789)
@@ -146,6 +146,14 @@
     ProcessingInstruction = PI
 
 
+class CEtree(EtreeEtree):
+    implements(IEtree)
+
+    def __init__(self):
+        import cElementTree
+        self.etree = cElementTree
+
+
 class EtreePy25(BaseEtree):
     """
     Support for ElementTree

Modified: zope.etree/trunk/src/zope/etree/tests.py
===================================================================
--- zope.etree/trunk/src/zope/etree/tests.py	2006-08-27 10:09:59 UTC (rev 69788)
+++ zope.etree/trunk/src/zope/etree/tests.py	2006-08-27 10:17:52 UTC (rev 69789)
@@ -178,6 +178,18 @@
         pass
 
     try:
+        import cElementTree
+        suite.addTest(unittest.makeSuite(OrigElementTreeTestCase))
+        suite.addTest(doctest.DocTestSuite(
+            "zope.etree.testing",
+            optionflags = doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
+            setUp = doctestSetup(etree.CEtree()),
+            tearDown = doctestTeardown))
+        foundetree = True
+    except ImportError:
+        pass
+
+    try:
         import lxml.etree
         suite.addTest(unittest.makeSuite(LXMLElementTreeTestCase))
         suite.addTest(doctest.DocTestSuite(

Modified: zope.etree/trunk/src/zope/etree/zope.etree-configure.zcml
===================================================================
--- zope.etree/trunk/src/zope/etree/zope.etree-configure.zcml	2006-08-27 10:09:59 UTC (rev 69788)
+++ zope.etree/trunk/src/zope/etree/zope.etree-configure.zcml	2006-08-27 10:17:52 UTC (rev 69789)
@@ -15,6 +15,15 @@
      />
 
   <!--
+      uses the *cElementTree* module.
+    -->
+<!--
+  <utility
+     factory="zope.etree.etree.CEtree"
+     />
+-->
+
+  <!--
       uses the *lxml* module.
     -->
 <!--



More information about the Checkins mailing list