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? Thanks, Ferhat __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--On 18. September 2006 06:43:46 -0700 Ferhat Ayaz <ferhatayaz@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?
That's the only way when you have to pass parameters to the method. Otherwise call it through context/mycall. -aj
--On Montag, 18. September 2006 06:43 -0700 Ferhat Ayaz <ferhatayaz@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
participants (3)
-
Andreas Jung -
Ferhat Ayaz -
Tino Wildenhain