[ZPT] Re: Accessing ZPT options name in Python Script

Evan Simpson evan at 4-am.com
Fri Apr 16 12:47:50 EDT 2004


Fernando Martins wrote:
> Is there a way in a Python Script called from a Page Template to access the
> options name(space) of the page template itself?

Only if you call it using a path expression.  Try the following pair:

<!-- Page Template "call_script" -->
<pre tal:content="here/print_bind"></pre>
<pre tal:content="python:here.print_bind()"></pre>


## Script (Python) "print_bind"
##bind namespace=b
##parameters=
##
for name in 'options', 'here', 'container':
   try:
     print name, ':', b[name]
   except:
     print name, 'not found in b.'
return printed


Cheers,

Evan @ 4-am





More information about the ZPT mailing list