[ZPT] How to get a reference to the current object.
John Morton
jwm@plain.co.nz
Tue, 11 Dec 2001 15:11:54 +1300
On Tuesday 11 December 2001 15:07, John Morton wrote:
> In the context of the file itself, I still want to use the filter, but
> something like this:
>
> <span tal:define="file here">
> <div metal:use-macro="here/filter/macros/filter_controls">Filters
> dialog</div> </span>
>
> ...ends up tying TALES into knots. The generated traceback looks like it
> chooses to opt out after two many levels of recursion, or similar.
>
> Is there an easy way to get a reference to the context object without using
> 'here'?
Isn't it funny how the answer to a question sometimes comes to you right
after you hit send :-). Using PARENTS[0] works a treat:
<span tal:define="file python:request.PARENTS[0]">
<div metal:use-macro="here/filter/macros/filter_controls">Filters
dialog</div> </span>
John