[ZPT] dynamic navigation menus

Evan Simpson evan@4-am.com
Thu, 01 Aug 2002 16:17:37 -0500


Mark McEahern wrote:
>   if current == container:
> 
> is always True.

Here's the culprit:

>       <td tal:attributes="class python:test(container.select_this(section),

Since you fetch 'select_this' from your container, the context of the 
call *is* the container.

You were expecting the context within 'select_this' to be the same as 
the calling template's context, which would only be true if you wrote 
"here.select_this(selection)".  The drawback of writing it that way is 
that this leaves the door open for a different 'select_this' object to 
be found in the template's context.

The only solid solution I know of is to pass your context explicitly, as 
in "container.select_this(section, here)".

Cheers,

Evan @ 4-am