[Zope] Arrggh, more namespace confusion ...

Sam Gendler sgendler@impossible.com
Sun, 13 Feb 2000 18:03:34 -0800


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 )