[Zope] Calling a Script from ZPT

Tino Wildenhain tino at wildenhain.de
Mon Sep 18 11:09:17 EDT 2006



--On Montag, 18. September 2006 06:43 -0700 Ferhat Ayaz 
<ferhatayaz at yahoo.com> wrote:

> Hi,
>
> a quick and newbie question:
>
> How can I call a Script (Python) within a page
> template. I'm using the 'define' tag:
>
> <tal:contain
>  define="no_matter_var
> python:context.mycall(myParam)"/>
>
> Is there a more serious way to do this?

Yes, don't do it :-)

PageTemplates are "views" and as such not
supposed to have sideeffects on application.

I'd do it in the application code instead,
e.g. before the pagetemplate is called.

(Yes you can return the result of a call to
a pagetemplate from a python script if you
want it easy :-)

e.g. python script:

doseomething ...

return context.thepagetemplate(arg1=var1, ...)


Regards
Tino


More information about the Zope mailing list