[ZPT] Re: Zpt, scripts and context problems

Evan Simpson evan at 4-am.com
Wed Nov 12 12:48:31 EST 2003


Karolin Marakool wrote:
[...]
>      tal:define="rlinks here/scripts/navRelated;>
[...]
> the navRelated script in scripts/ folder:
>  
> if hasattr(context.aq_explicit, 'subject'):
>     subjects=context.subject
[...]
> The problem is I keep on getting "scripts" as the context
> returned instead of the page template. 

Inside navRelated, the scripts Folder is both the container and the 
context (since you didn't acquire it from something else).  You could 
play games with acquisition to try to arrange otherwise, but that way 
lies madness.  You could use navRelated's Bindings tab to bind the 
template's namespace to a name such as 'tnames', and access the template 
itself as "tnames['template']".  Much better, if less compact, would be 
to pass 'template' explicitly to navRelated as a parameter.

Cheers,

Evan @ 4-am





More information about the ZPT mailing list