[ZPT] CVS: Zope/lib/python/ZTUtils - Tree.py:1.8

Martijn Pieters mj@zope.com
Thu, 3 Oct 2002 17:50:17 -0400


Update of /cvs-repository/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv21522/lib/python/ZTUtils

Modified Files:
	Tree.py 
Log Message:
Encode depth of a tree node with '_' characters instead of '.' characters,
as endoded node ids can start with a '.' as well. Also more rigorously test
for an encoded depth when decoding.


=== Zope/lib/python/ZTUtils/Tree.py 1.7 => 1.8 ===
--- Zope/lib/python/ZTUtils/Tree.py:1.7	Thu Oct  3 17:08:40 2002
+++ Zope/lib/python/ZTUtils/Tree.py	Thu Oct  3 17:50:17 2002
@@ -189,7 +189,7 @@
         dd = last_depth - node.depth + 1
         last_depth = node.depth
         if dd > 0:
-            steps.append('.' * dd)
+            steps.append('_' * dd)
         steps.append(node.id)
         node.expansion_number = n
         n = n + 1
@@ -207,7 +207,7 @@
     if nth is not None:
         nth_pair = (None, None)
     for step in s.split(':'):
-        if step[:1] == '.':
+        if step == len(step) * '_':
             pop = len(step) - 1
             continue
         if pop < 0: