[Zope] tree structure in zope

Mario Valente mvalente@ruido-visual.pt
Mon, 12 Feb 2001 20:16:58 +0000


At 14:10 2/10/01 +0100, Dieter Maurer wrote:
>jacintha menezes writes:
> >         Kindly may i know when a tree gets expanded in zope does it
rebuild
> > from root
> > (starting position) or it gets rebuild from the place it gets expanded.
>
>Usually, the hierarchy is simply there, the tree tag just displays part of
it.
>
>The table representing the tree is regenerated for each request
>from scratch. Thus, the "branches" method (or "branches_expr")
>is recalled for all visible tree nodes and not only
>for the expanded node.
>

  Which becomes quite a bother when you have a tree branch
 with a bazillion objects.

  And when that tree branch is within Zope itself, management
 tasks (which always display the tree on the left frame) become
 impossible.

  We had a BTree folder hanging from our root folder with about
 20.000 objects. Management tasks took forever. Each click expanded
 the tree, which refreshed the left frame, which took forever.

  The dtml-tree option "assume_children=1" came in handy (if 1 then all 
 items are assumed to have subitems and will therefore always have a 
 plus sign in front of them when they are collapsed. Only when an item
 is expanded will subobjects be looked for).

  By using it in your tree tag (in our case we changed
lib/python/App/menu.dtml
 directly) you'll get much faster trees. You lose the
"no-plus-sign-if-it-doesnt-have-
 children" feature, but I'll take that anytime :-) I prefer to click and
find there's no 
 subtree instead of waiting ages to get to what I want.

  C U!

  -- Mario Valente