[ZPT] Re: calling a python script from ZPT

Tonico Strasser contact_tonico at yahoo.de
Fri Jul 1 11:04:17 EDT 2005


Kenneth Gonsalves schrieb:
> hi
> i have a python script called getnames
> i call it like this
> <p tal:repeat="results python:context.getnames(table=tablename)">
> 
> now this script is in ploneroot/mainpage
> 
> if i call this from the mainpage folder or any sub folder there is no 
> problem. But i want to call it from somewhere else in the site
> 
> i tried:
> python:${plone_url}.mainpage.getnames()
> and
> python:${plone_url}/mainpage/getnames()
> 
> but both dont compile - any clues?

Yes, the expressions above are not valid. Yo are trying to mix a string 
expression with a python expression.

Find out more about TALES (TAL Expression Syntax).
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx#2-40

I don't know what 'plone_url' is, but thanks to Zope acquisition you can 
write this as:

   Path expression: "here/mainpage/getnames"

   or Python expression: "python:here.mainpage.getnames()"

   or String expression: "string:${here/mainpage/getnames}"

HTH,
Tonico





More information about the ZPT mailing list