[Zope] ZopeTree tree-expansion cookies: question

Jean Jordaan jean@upfrontsystems.co.za
Wed, 26 Mar 2003 17:43:43 +0200


Hi Philipp

I've just start using your ZopeTree product (with a lot of
gratification, I might add), and I've got a question about how
the 'tree-expansion' cookie works.

The behaviour that prompted my question is this: using Mozilla
1.2.1, when browsing around a site which displays a tree, the state
of the tree depends on where I am in the site. For example, at
/position/a I might have collapsed half the tree. I go to
/position/a/b and expand everything. If I then go to /position/a
again, the tree is half-collapsed, the way I left it, instead of
the way I set it while at /position/a/b.

I checked the cookies Mozilla was holding, and saw that it had a
'tree-expansion' cookie for every path where I changed the state
(i.e. every path where setCookie was called). I suspect this is
because the cookie is set without a 'path' specification, and
Mozilla is being conservative and restricting the cookie to the
path where it is being set.

  request.RESPONSE.setCookie(request_variable, tree_expansion)

To fix this situation for me, I can change ZopeTree to set the
cookie's path to the path of the tree's root_object. What do you
think of that?

-- 
Jean Jordaan
http://www.upfrontsystems.co.za