[Zope] Calling a Script from ZPT

2006-09-18 Thread Ferhat Ayaz
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 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Calling a Script from ZPT

2006-09-18 Thread Andreas Jung



--On 18. September 2006 06:43:46 -0700 Ferhat Ayaz [EMAIL PROTECTED] 
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

pgpDoJ01dhawV.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Calling a Script from ZPT

2006-09-18 Thread Tino Wildenhain



--On Montag, 18. September 2006 06:43 -0700 Ferhat Ayaz 
[EMAIL PROTECTED] 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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )