Re: [Zope] python script returning a 'rendered' zpt
did you try; something = context.REQUEST.form['target'] somepage = context.REQUEST['URLPATH1'] #may be URL1 some_page_template = context[somepage] rendered_html = some_page_template(context, somevariable=something) I'm writing from (faulty) memory here so context[somepage] may not work. If it doesn't get ahold of the relevant folder by using resticted traverse and then use: some_page_template = thefolder[somepage] If that still doesn't work email me and I will work it out on my development box. It is def doable. -Tim On 3/6/08, David Bear [EMAIL PROTECTED] wrote: On Thursday 06 March 2008 18:04, Peter Bengtsson wrote: rendered_html = context.some_page_template(context, somevariable='foobar') But then you need to write the page template as: div tal:contents=options/somevariable blah /div This is almost what I need. However, I can't use 'context.somepage' in the script becuase I don't know what somepage will be. I was hoping to be able to call the script on any arbitrary zpt like this: /zope/somepagetemplate/myscript?target=something Then 'myscript' will grab the value of target and returned 'somepagetemplate' where the value of somevariable was replaced with 'something' On 07/03/2008, David Bear [EMAIL PROTECTED] wrote: I need to right a script that will return a zpt. However, I need the script to feed the zpt some values and then have zope returned the rendered zpt. I hope this is possible. For example, lets say I have something like this in a zpt div tal:contents=somevariable blah /div My python script with have something like this: somevariable = this is a test How can I get the script to returned the 'rendered' zpt? -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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 ) -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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 ) ___ 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 )
[Zope] python script returning a 'rendered' zpt
I need to right a script that will return a zpt. However, I need the script to feed the zpt some values and then have zope returned the rendered zpt. I hope this is possible. For example, lets say I have something like this in a zpt div tal:contents=somevariable blah /div My python script with have something like this: somevariable = this is a test How can I get the script to returned the 'rendered' zpt? -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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] python script returning a 'rendered' zpt
rendered_html = context.some_page_template(context, somevariable='foobar') But then you need to write the page template as: div tal:contents=options/somevariable blah /div On 07/03/2008, David Bear [EMAIL PROTECTED] wrote: I need to right a script that will return a zpt. However, I need the script to feed the zpt some values and then have zope returned the rendered zpt. I hope this is possible. For example, lets say I have something like this in a zpt div tal:contents=somevariable blah /div My python script with have something like this: somevariable = this is a test How can I get the script to returned the 'rendered' zpt? -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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 ) -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.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] python script returning a 'rendered' zpt
On Thursday 06 March 2008 18:04, Peter Bengtsson wrote: rendered_html = context.some_page_template(context, somevariable='foobar') But then you need to write the page template as: div tal:contents=options/somevariable blah /div This is almost what I need. However, I can't use 'context.somepage' in the script becuase I don't know what somepage will be. I was hoping to be able to call the script on any arbitrary zpt like this: /zope/somepagetemplate/myscript?target=something Then 'myscript' will grab the value of target and returned 'somepagetemplate' where the value of somevariable was replaced with 'something' On 07/03/2008, David Bear [EMAIL PROTECTED] wrote: I need to right a script that will return a zpt. However, I need the script to feed the zpt some values and then have zope returned the rendered zpt. I hope this is possible. For example, lets say I have something like this in a zpt div tal:contents=somevariable blah /div My python script with have something like this: somevariable = this is a test How can I get the script to returned the 'rendered' zpt? -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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 ) -- David Bear College of Public Programs/ASU 411 N Central, Phoenix, AZ 85004 ___ 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 )