Arrggh, more namespace confusion ...
I'm on the tail-end of another 48-hour Zoping marathon but just when I can see the proverbial light - click(). Arggh. I've pared my current problem down to: root spam (DTML method) folder1 folder2 where spam contains: <dtml-var "REQUEST.set('mylist', ['folder1','folder2'])"> <dtml-in mylist> <dtml-with sequence-item><dtml-var id></dtml-with> </dtml-in> My aim is to loop over mylist pushing sequence-item onto the namespace stack, ie, <dtml-with folder1><dtml-var id></dtml-with> <dtml-with folder2><dtml-var id></dtml-with> I've toyed with every version of the <dtml-with> tag I can imagine but to no avail. Can someone please explain the source of my confusion. Cheers, Darran.
I would look into the possibility that dtml-with is getting a string when it wants a reference . If that's the case, there must be a method that does the conversion, but I don't know right off what that would be. -- HTH -- Loren ----- Original Message ----- From: Darran Edmundson <Darran.Edmundson@anu.edu.au> To: zope <zope@zope.org> Sent: February 13, 2000 05:01 PM Subject: [Zope] Arrggh, more namespace confusion ...
I'm on the tail-end of another 48-hour Zoping marathon but just when I can see the proverbial light - click(). Arggh. I've pared my current problem down to:
root spam (DTML method) folder1 folder2
where spam contains:
<dtml-var "REQUEST.set('mylist', ['folder1','folder2'])"> <dtml-in mylist> <dtml-with sequence-item><dtml-var id></dtml-with> </dtml-in>
My aim is to loop over mylist pushing sequence-item onto the namespace stack, ie,
<dtml-with folder1><dtml-var id></dtml-with> <dtml-with folder2><dtml-var id></dtml-with>
I've toyed with every version of the <dtml-with> tag I can imagine but to no avail. Can someone please explain the source of my confusion.
Cheers, Darran.
_______________________________________________ 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 )
How about <dtml-in "objectValues(['Folder'])"> <dtml-if "id=='folder1' or id=='folder2'"> <dtml-var title_or_id> </dtml-if> </dtml-in> objectValues returns a list of objects of the specified type. I believe there is an objectIds() function that just returns id's, if that is really all you are interested in. If you want a listing of all folders, you can get rid of the <dtml-if> statement. If you want all objects, you can just pass no parameters to the objectValues function. This is untested code. I have no idea if logical or works in a dtml-if statement (I don't know why it wouldn't). See the ZQR for more details on objectValues (http://www.zope.org/Members/ZQR if memory serves correctly). --sam Darran Edmundson wrote:
I'm on the tail-end of another 48-hour Zoping marathon but just when I can see the proverbial light - click(). Arggh. I've pared my current problem down to:
root spam (DTML method) folder1 folder2
where spam contains:
<dtml-var "REQUEST.set('mylist', ['folder1','folder2'])"> <dtml-in mylist> <dtml-with sequence-item><dtml-var id></dtml-with> </dtml-in>
My aim is to loop over mylist pushing sequence-item onto the namespace stack, ie,
<dtml-with folder1><dtml-var id></dtml-with> <dtml-with folder2><dtml-var id></dtml-with>
I've toyed with every version of the <dtml-with> tag I can imagine but to no avail. Can someone please explain the source of my confusion.
Cheers, Darran.
_______________________________________________ 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 )
participants (3)
-
Darran Edmundson -
Loren Stafford -
Sam Gendler