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

Fernando Martins fernando at cmartins.demon.nl
Mon Apr 19 03:24:18 EDT 2004


Evan Simpson wrote:
> 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:

That's what I wanted.

>
> <!-- 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=
> ##

Aha! My intuition was rigth. Together with the other remarks from Casey
Duncan, I get it. And from the zope book:

"Namespace
    The Namespace binding is left blank by default. If your script is called
from a DTML Method, and you have chosen a name for this binding, then the
named variable contains the DTML namespace explained in the chapter entitled
Advanced DTML ."

Mutatis mutantis for ZPT and I guess DTML strikes back with a revenge!

It's just a pitty the difference in semantics (in the path vs python syntax)
from what should be the same thing, no?

Care to explain what's going on?

Many thanks,

Fernando




More information about the ZPT mailing list