[ZPT] Re: Accessing ZPT options name in Python Script
Casey Duncan
casey at zope.com
Fri Apr 16 09:47:05 EDT 2004
On Thu, 15 Apr 2004 23:03:38 +0200
"Fernando Martins" <fernando at cmartins.demon.nl> wrote:
> Casey Duncan wrote:
> > "Fernando Martins" <fernando at cmartins.demon.nl> 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?
> > >
> > > Of course this could be passed to the script by using its
> > > parameters but I was thinking more on a binding-based solution
> > > (which I couldn't figure out).
> >
> > There is no implicit binding between namespaces here like there was
> > in DTML, and that's a good thing! 'options' is just a dictionary (or
>
> I'm really not familiar with DTML (and happy about that from what I've
> seen). Does the problem come from the "implicitness"? Why not have an
> explicit binding for the calling template, or treating the Script as a
> method of the object "template"?
>
> In fact, I was surprised to see that "context" seems to be the folder
> of the template and not the template itself.
You could call the script in the context of the template (use
python:template.script()), but it would not help you. 'options' is not
an attribute of the template, it is a transient value bound to the call
frame of the template code being executed. It is a run-time variable,
not a persistent data element.
-Casey
More information about the ZPT
mailing list