Thanks to both Paul and AJ -- both suggestions were helpful. The extended description Paul gave me below was particularly use.<br><br>Here's what I learned:<br>1) the form object is automagically handed to the template when you do a 'return context.mytemplate(item='something')<br>
2) I assumed that I would have to pass the form object to the template -- but this is not needed. More usefull is that when 'item' is given to the template as parameter, shown above, that the template gets a NEW? namespace called 'options'. I think this is new to me.<br>
3) then, within the template the tales expression options/item gives me 'something'.<br><br>This really helps me understand better how script and templates work together. A year from now, I'll need to relearn this again and may google my answer above...<br>
<br>Thanks to all on the plone list.<br><br><div><span class="gmail_quote">On 9/10/08, <b class="gmail_sendername">Paul Winkler</b> <<a href="mailto:slinkp@gmail.com">slinkp@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
On Wed, Sep 10, 2008 at 07:57:29PM -0700, David Bear wrote:<br> > I have a script that calls a template.<br> ><br> > The template has a tal expressions like this<br> ><br> > <p tal:content="structure here/ploneDoc/getText"> </p><br>
><br> > I want my script to call the template in such a way that the string<br> > 'ploneDoc' is replaced by a different string.<br> ><br><br>> I'm not sure how to go about parameterizing a tales expressions like<br>
> this.<br><br> It is possible, by sticking a question mark in front of ploneDoc; but<br> afaict you can only use a variable already in the namespace,<br> i.e. you'd have to define it first. Like so:<br><br> <p tal:define="docname options/ploneDoc"<br>
tal:content="structure here/?docname/getText"> </p><br><br> But I have literally never seen this obscure feature in real use,<br> because nobody seems to know about it (I had forgotten it myself), and<br>
because it's not necessary. I'd prefer to have the script just pass in<br> the object you want, as per this document:<br> <a href="http://plope.com/Books/2_7Edition/BasicScripting.stx#1-3">http://plope.com/Books/2_7Edition/BasicScripting.stx#1-3</a><br>
<br> So, in your script, something like:<br><br> doc = context.restrictedTraverse(some_path)<br> return context.mytemplate(mydoc=doc)<br><br> Then, in your template just do:<br><br> <p tal:content="structure options/mydoc/getText"></p><br>
<br><br><br> --<br><br> Paul Winkler<br> <a href="http://www.slinkp.com">http://www.slinkp.com</a><br> _______________________________________________<br> Zope maillist - <a href="mailto:Zope@zope.org">Zope@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope</a><br> ** No cross posts or HTML encoding! **<br> (Related lists -<br> <a href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce</a><br>
<a href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br></blockquote></div><br><br clear="all"><br>-- <br>David Bear<br>College of Public Programs at ASU<br>602-464-0424