[Zope-Checkins] CVS: Zope/lib/python/ZTUtils - SimpleTree.py:1.4 Tree.py:1.7

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


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

Modified Files:
	SimpleTree.py Tree.py 
Log Message:
Fix ZTUtils tree makers:

- SimpleTree could not build a tree from anything but the ZODB root object,
  because the REQUEST object could no longer be acquired once a tree root object
  was wrapped inside a tree node class.

- TreeMaker.setChildAccess(filter=...) didn't work because the acquisition
  filter used was using too many arguments.


=== Zope/lib/python/ZTUtils/SimpleTree.py 1.3 => 1.4 ===
--- Zope/lib/python/ZTUtils/SimpleTree.py:1.3	Wed Aug 14 18:10:12 2002
+++ Zope/lib/python/ZTUtils/SimpleTree.py	Thu Oct  3 17:08:40 2002
@@ -52,6 +52,9 @@
         node.id = b2a(self.getId(object))
         return node
 
-    def markRoot(self, node):
-        node.tree_pre = self.tree_pre
-        node.baseURL = node.object.REQUEST['BASEPATH1']
+    def tree(self, root, expanded=None, subtree=0):
+        node = TreeMaker.tree(self, root, expanded, subtree)
+        if not subtree:
+            node.tree_pre = self.tree_pre
+            node.baseURL = root.REQUEST['BASEPATH1']
+        return node


=== Zope/lib/python/ZTUtils/Tree.py 1.6 => 1.7 ===
--- Zope/lib/python/ZTUtils/Tree.py:1.6	Wed Aug 14 18:10:12 2002
+++ Zope/lib/python/ZTUtils/Tree.py	Thu Oct  3 17:08:40 2002
@@ -106,8 +106,6 @@
             node.state = -1 # collapsed
         if not subtree:
             node.depth = 0
-            if hasattr(self, 'markRoot'):
-                self.markRoot(node)
         return node
 
     def node(self, object):
@@ -143,8 +141,8 @@
                            type(0L):1, type(None):1 }.has_key):
     return is_simple(type(ob))
 
-def aqcallback(self, inst, parent, name, value, filter):
-    return filter(self, inst, parent, name, value)
+def aqcallback(self, inst, name, value, filter):
+    return filter(self, inst, name, value)
 
 from binascii import b2a_base64, a2b_base64
 from string import translate, maketrans