[Zope] ZPT & passing around options...

Paul Winkler pw_lists@slinkp.com
Tue, 10 Sep 2002 08:10:07 -0700


On Tue, Sep 10, 2002 at 12:56:01AM -0500, Edward Muller wrote:
> Because of my design, in a Python script I need to call something like:
>   return container.content(variable1="sometxt", var2=["text1","text2"])
> 
> This ends up calling the local content, without the surrounding site
> look'n'feel, <html> tags ... and the rest ... which is bad ...
> 
> And ... calling index_html like so:
>   return container.index_html(variable1="sometxt",
> var2=["text1","text2"])
> (line may be wrapped)
> 
> works fine wrt the site loook'n'feel and structure and all ... but the
> variables I pass into index_html get passed to the local content object,
> which is what I need to do.

I assume you meant to say "the variables ... do NOT get passed to the
local content object, which is what I need to do"

If that's what you want, one way you can do it is like so:

Give your script the REQUEST parameter.

In your script, do this:

REQUEST.set('foo', 'spam spam spam spam')
return context.index_html(REQUEST)


Then you can refer to this variable in your content object like so:

   <p tal:content="request/foo">   </p>

Or if it's sometimes in the request and sometimes in the context...

   <p tal:content="here/foo | request/foo"> </p>


hope that helps,


PW

--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"