[Lxml-checkins] r44197 - in lxml/branch/lxml-1.3: . src/lxml

scoder at codespeak.net scoder at codespeak.net
Tue Jun 12 19:39:33 CEST 2007


Author: scoder
Date: Tue Jun 12 19:39:33 2007
New Revision: 44197

Modified:
   lxml/branch/lxml-1.3/TODO.txt
   lxml/branch/lxml-1.3/src/lxml/etree.pyx
   lxml/branch/lxml-1.3/versioninfo.py
Log:
merged in revs 43837:43853 from trunk

Modified: lxml/branch/lxml-1.3/TODO.txt
==============================================================================
--- lxml/branch/lxml-1.3/TODO.txt	(original)
+++ lxml/branch/lxml-1.3/TODO.txt	Tue Jun 12 19:39:33 2007
@@ -17,12 +17,6 @@
 * more testing on multi-threading
 
 
-ElementTree
------------
-
-* _setroot(), even though this is not strictly a public method.
-
-
 QName
 -----
 

Modified: lxml/branch/lxml-1.3/src/lxml/etree.pyx
==============================================================================
--- lxml/branch/lxml-1.3/src/lxml/etree.pyx	(original)
+++ lxml/branch/lxml-1.3/src/lxml/etree.pyx	Tue Jun 12 19:39:33 2007
@@ -1190,6 +1190,14 @@
             self._doc = None
         return self._context_node
 
+    def _setroot(self, _Element root not None):
+        """Relocate the ElementTree to a new root node.
+        """
+        if root._c_node.type != tree.XML_ELEMENT_NODE:
+            raise TypeError, "Only elements can be the root of an ElementTree"
+        self._context_node = root
+        self._doc = None
+
     def getroot(self):
         """Gets the root element for this tree.
         """

Modified: lxml/branch/lxml-1.3/versioninfo.py
==============================================================================
--- lxml/branch/lxml-1.3/versioninfo.py	(original)
+++ lxml/branch/lxml-1.3/versioninfo.py	Tue Jun 12 19:39:33 2007
@@ -38,7 +38,9 @@
         elif data.startswith('<?xml'):
             # SVN <= 1.3
             dirurl = urlre.search(data).group(1)    # get repository URL
-            localrev = max([int(m.group(1)) for m in revre.finditer(data)])
+            revs = [int(m.group(1)) for m in revre.finditer(data)]
+            if revs:
+                localrev = max(revs)
         else:
             from warnings import warn
             warn("unrecognized .svn/entries format; skipping "+base)


More information about the lxml-checkins mailing list