[Zope] Re: Why doesn't this loop over files?

Butch Landingin butchland@yahoo.com
Mon, 8 Mar 1999 18:23:55 -0800 (PST)


In a previous posting, Tony McDonald <tony.mcdonald@ncl.ac.uk> wrote:

>Hi,
>I've d/led the ZopeDemos folder, installed it and started learning 
>more about Zope, but there's something happening that I'm not sure 
>about.
>
>The 'looping' example doesn't seem to iterate correctly over new 
>additions to the folder. The DTML is here:
<... additional text deleted ...>

There's a bug in the code, something I noticed when I was playing 
with the examples too. this is the fixed version:

001 <!--#in "['Document','Folder']"-->
002 <!--#with subFolder-->
003 <!--#if "objectValues(_['sequence-item'])"-->
004    <H3>Objects of type <!--#var sequence-item--></H3>
005   <TABLE BORDER=1>
006   <TH>Id</TH><TH>Title</TH>
007      <!--#in "objectValues(_['sequence-item'])"-->
008        <TR><TD><!--#var id--></TD>
009        <TD><!--#var title--></TD></TR>
010      <!--#/in-->
011   </TABLE>
012 <!--#/if-->
013 <!--#/with-->
014 <!--#/in-->

About the bug and the fix:
the bug was due to the statement <!--#if
"objectValues(_['sequence-item'])"-->
looping over the current folder, not the subFolder which it should be.
By moving the "with" statement to enclose it (see line 002), the
statement <!--#if "objectValues(... now loops over the objects inside
the folder named "subFolder".

I don't know who is maintaining the ZopeDemos product (or if it's
being maintained at all), 
but I hope he/she takes note of this and posts an update. 

Hope this helps.

Butch Landingin
butchland@yahoo.com

PS. I'm playing around with the Confera product (making it more
slashdot-like) but I know it's
not "officially supported" by Zope/DC -- so who's maintaining it? I
have some detailed questions about the code (but I don't know if it's
off-topic for Zope/Zope-dev).








_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com