On Fri, Jun 14, 2002 at 02:08:58PM +0200, Paz wrote:
I'm sorry to have to post this request, but I'm lost behind python syntax again.
This works:
<dtml-with "folder1.folder2"><dtml-var index_html></dtml-with>
This doesn't: <dtml-call "REQUEST.set('sName', 'folder1.folder2')"> <dtml-with "_[sName]"><dtml-var index_html></dtml-with>
To expand on Oleg's remark in a different way -- _[sName] asks for the contents in the _ namespace of the item whose name is given by the variable sName. You wanted _['sName'], which is the contents in the _ namespace of the item named 'sName'. Note the extra level of dereferencing. 90% of the time, when you are working with a dictionary, you want dict['someName']. And the other 10% of the time, you have to be sure that if you use dict[someVariable], that variable has been assigned a valid name of an item in the dictionary. [Technically, this language is not quite right, I should be talking of keys and values, (rather than variables and contents), but I think the way I have said it will be easier to wrap your mind around.] On the other hand, it would not have worked anyway, per Oleg's explanation. Jim Penny
Nor does: <dtml-with "_.getitem(sName)"><dtml-var index_html></dtml-with>
What am I missing?
Thanks, Paz
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )