José Henrique wrote:
Use "print template.getId()".

2005/10/4, Chris Miles <[EMAIL PROTECTED]>:

I have a Page Template in a folder: folder1/
 <span tal:replace="here/myscript">Testing</span>

myscript is a Script (Python) containing:
 print context.getId()
 return printed

Now, when folder1/ is called TTW, it displays "folder1" as the
context.getId(), but I was expecting (and hoping) it would display
""...  Isn't it being called within the "context" of

 I am not sure if the solution above works that straight in the script;
it does not magically inherit the "template" variable from the page
template, does it?

 The way I would prefer to handle this is to pass the template to the script
explicitely, e.g.:

  <span tal:replace="python:here.myscript(template)">Testing</span>

Then add "template" to the parameters of Your script, and
template.getId() will work.

 If this is to explicit for You, calling the script via:

<span tal:replace="template/script">Testing</span>

should do what You want: not the script is called having the
template as the context (unlike "here/script", where the script has
the same context as the template).


ZPT mailing list

Reply via email to