[Zope-dev] tree tag _extraordinary_ namespace ugliness.

Anthony Baxter anthony@interlink.com.au
Wed, 19 Jan 2000 13:41:14 +1100


Ok, this is making my brain hurt.

Say I have something like the following:

<dtml-let id="top">
    <dtml-tree id=id branches_expr="somefunc(parent_id=id)">
    foo foo foo.
    </dtml-tree>
</dtml-let>

The 'id' the first time through will be the id of the surrounding
document, _not_ the value in the 'let' tag. Looking at TreeTag.py,
we can see (this is around about line 260 or 270... the line numbers
in my version are way off the standard version)

    treeData={'tree-root-url': root,
              'tree-colspan': colspan,
              'tree-state': state }

    md._push(InstanceDict(self, md))   ## problem line
    md._push(treeData)

    try: tpRenderTABLE(self,id,root,url,state,substate,diff,data,colspan,
                       section,md,treeData, level, args)
    finally: md._pop(2)

(I've added '## problem line' to point out the problem.)

This is pretty bogus - it screws up the namespace "stack" pretty badly.

This was added in version 1.22 of TreeDisplay.py, the commit comment
is 
    revision 1.22
    date: 1998/04/08 17:45:32;  author: jim;  state: Exp;  lines: +73 -27
    Major rerrangement of namespace management.
    Switches to short-circuit rendering.
    New expand, which needs to be tested.
    Now check security of items, and new skip_unauthorized attr.
    New branches_expr.

I've commented out the line above, and changed the md._pop to only
pop the top item. Things still work for me, and it fixes the bogosity
I was seeing.

Can someone explain to me what the above is supposed to be doing, and
why removing it might be bad? If it's just a speedup to put stuff closer
to the top of the multimapping, then it should probably die, but maybe
it has some deeper purpose...

I haven't submitted this to the collector, as I'm not convinced that it's
actually a bug yet.

Anthony