[ZPT] ZPT and Python Scripts

Tino Wildenhain tino at wildenhain.de
Fri Sep 26 02:33:21 EDT 2003


Hi Bob,

Evan Simpson wrote:
> Bob Gailer wrote:
> 
>> I have wandered around the Zope Book and the ZPT archive. I am still 
>> wishing for some comprehensive explanation of the various ways one can 
>> invoke python scripts and use the results in zpt. I have found a 
>> number of interesting examples, but no technical explanation of the 
>> mechanisms.
> 
> 
> I'm not sure what you're looking for.  You call a Script, you get back 
> whatever data structure you build in the Script.  If it's a sequence, 
> you can use tal:repeat on it.  If it's a dictionary, you can use paths 
> to access the values in it.  By nesting sequences and dictionaries, you 
> can do complex things, but this has nothing in particular to do with 
> "mechanisms".

As long as we dont have these special prefixes, I dont think pure
path access lets you access dictionary values of a script directly.
e.g. here/theScript/key does not work

Another common approach is to call the python Script and
return a ZPT from it via

return context.theZPT(arg1=foo,arg2=bar)

and so on.

Regards
Tino




More information about the ZPT mailing list