Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to "generic" template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel
Pavel Zaitsev wrote:
Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to "generic" template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel
Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have <forms> submit with an action="." and method="post". Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. David
В Пнд, 24/07/2006 в 15:00 -0700, David H пишет
Pavel,
You question is a bit vague but ...
Make your index_html a python script. And then stuff your REQUEST with info you want
Then just call the Page Template ...
request.set('formvar1', somevalue) return context.myPageTemplate(context.request)
Of course of you have <forms> submit with an action="." and method="post".
Then you can intercept all calls using index_html, do what you need to do and *then* render the next form.
here is description: root/ index_html index_tmpl <-- invokes here.content_html root/some/web/page index_html <-- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html <-- gets called from index_tmpl So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie <span tal:replace="username"/> should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel
Pavel Zaitsev wrote:
В Пнд, 24/07/2006 в 15:00 -0700, David H пишет
Pavel,
You question is a bit vague but ...
Make your index_html a python script. And then stuff your REQUEST with info you want
Then just call the Page Template ...
request.set('formvar1', somevalue) return context.myPageTemplate(context.request)
Of course of you have <forms> submit with an action="." and method="post".
Then you can intercept all calls using index_html, do what you need to do and *then* render the next form.
here is description:
root/ index_html index_tmpl <-- invokes here.content_html
root/some/web/page index_html <-- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html <-- gets called from index_tmpl
So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie <span tal:replace="username"/> should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel
Pavel, How are you invoking templates? Give code snippets. Have you read the "Advanced Scripting" section in the Zope book? Plope.com has a the latest version (i think). David
participants (2)
-
David H -
Pavel Zaitsev