tree tag _extraordinary_ namespace ugliness.
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
On Wed, Jan 19, 2000 at 01:41:14PM +1100, Anthony Baxter wrote:
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>
[snip of the rest of problem desc and tentative fix.] Works for me. I was trying to to a <dtml-tree> within a <dtml-in> and was seeing pretty much the same namespace weirdness. All fixed by applying the following diff to lib/python/TreeDisplay/TreeTag.py in Zope 2.1.2 on FreeBSD/i386 4.0-CURRENT. *** TreeTag.py.old Fri Jan 21 13:22:48 2000 --- TreeTag.py Fri Jan 21 13:22:57 2000 *************** *** 238,249 **** 'tree-colspan': colspan, 'tree-state': state } - md._push(InstanceDict(self, md)) md._push(treeData) try: tpRenderTABLE(self,id,root,url,state,substate,diff,data,colspan, section,md,treeData, level, args) ! finally: md._pop(2) if state is substate and not (args.has_key('single') and args['single']): state=state or ([id],) --- 238,248 ---- 'tree-colspan': colspan, 'tree-state': state } md._push(treeData) try: tpRenderTABLE(self,id,root,url,state,substate,diff,data,colspan, section,md,treeData, level, args) ! finally: md._pop(1) if state is substate and not (args.has_key('single') and args['single']): state=state or ([id],) -- Benno Rice "No, no. We're *sweet* and XNFP Aries Dark Subculture- *innocent* evil bastards." friendly Internet Geek benno@netizen.com.au "Defend your joy"
(Sorry about sending this multiple times. I goofed.) On Wed, Jan 19, 2000 at 01:41:14PM +1100, Anthony Baxter wrote:
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>
[snip of the rest of problem desc and tentative fix.] Works for me. I was trying to to a <dtml-tree> within a <dtml-in> and was seeing pretty much the same namespace weirdness. All fixed by applying the following diff to lib/python/TreeDisplay/TreeTag.py in Zope 2.1.2 on FreeBSD/i386 4.0-CURRENT. *** TreeTag.py.old Fri Jan 21 13:22:48 2000 --- TreeTag.py Fri Jan 21 13:22:57 2000 *************** *** 238,249 **** 'tree-colspan': colspan, 'tree-state': state } - md._push(InstanceDict(self, md)) md._push(treeData) try: tpRenderTABLE(self,id,root,url,state,substate,diff,data,colspan, section,md,treeData, level, args) ! finally: md._pop(2) if state is substate and not (args.has_key('single') and args['single']): state=state or ([id],) --- 238,248 ---- 'tree-colspan': colspan, 'tree-state': state } md._push(treeData) try: tpRenderTABLE(self,id,root,url,state,substate,diff,data,colspan, section,md,treeData, level, args) ! finally: md._pop(1) if state is substate and not (args.has_key('single') and args['single']): state=state or ([id],) -- Benno Rice "No, no. We're *sweet* and XNFP Aries Dark Subculture- *innocent* evil bastards." friendly Internet Geek benno@netizen.com.au "Defend your joy"
participants (2)
-
Anthony Baxter -
Benno Rice