[ZPT] CVS: Releases/Zope/lib/python/ZTUtils - Zope.py:1.5
Evan Simpson
evan@zope.com
Fri, 2 Nov 2001 15:04:02 -0500
Update of /cvs-repository/Releases/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv3792
Modified Files:
Zope.py
Log Message:
Provide default state argument for cookie-driven trees.
=== Releases/Zope/lib/python/ZTUtils/Zope.py 1.4 => 1.5 ===
class SimpleTreeMaker(TreeSkipMixin, SimpleTreeMaker):
_getChildren = SimpleTreeMaker.getChildren
- def cookieTree(self, root_object):
+ def cookieTree(self, root_object, default_state=None):
'''Make a tree with state stored in a cookie.'''
tree_pre = self.tree_pre
state_name = '%s-state' % tree_pre
@@ -202,6 +202,8 @@
del m[obid]
else:
state = decodeExpansion(state)
+ else:
+ state = default_state
tree = self.tree(root_object, state)
rows = tree.flat()
req.RESPONSE.setCookie(state_name, encodeExpansion(rows))