Re: Why doesn't this loop over files?
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
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-->
Butch, Thanks for the reply - but this doesn't work completely either. I can add folders and delete them and the changes made show up in the listing, but adding documents (both documents and methods) has no effect. If I delete the *original* documents created by the installation, they show up as being gone, but even a copy-paste of the original documents doesn't get any new documents/methods etc. to show up. Am I doing a dumb newbie thing here? (I *do* have a folder called 'subFolder' btw). many thanks tone ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
Hi All, The DTML Example folder has been updated. I've incorporated the fix below, but the reason that new documents were not showing up is that the page was looking for the wrong 'meta_type' for objects in the subfolder. Up till the last release, documents had a meta_type attribute of 'Document', but now documents either have 'DTML Document' or 'DTML Method' as their meta_type. Tony's problem was that Zope was correctly respecting the meta_type of the 'old' Document objects included with the demo, but any new documents added afresh were being created with the 'DTML Document' or 'DTML Method' meta-types, which were falling through the objectValues 'sieve'. Here's the new version... Cheers, Andy. <!--#in "['Document','Folder', 'DTML Document', 'DTML Method']"--> <!--#with subFolder--> <!--#if "objectValues(_['sequence-item'])"--> <H3>Objects of type <!--#var sequence-item--></H3> <TABLE BORDER=1> <TH>Id</TH><TH>Title</TH> <!--#in "objectValues(_['sequence-item'])"--> <TR><TD><!--#var id--></TD> <TD><!--#var title--></TD></TR> <!--#/in--> </TABLE> <!--#/if--> <!--#/with--> <!--#/in-->
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Tony McDonald Sent: Tuesday, March 09, 1999 4:46 AM To: Butch Landingin Cc: zope@zope.org Subject: [Zope] Re: Why doesn't this loop over files?
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-->
Butch, Thanks for the reply - but this doesn't work completely either. I can add folders and delete them and the changes made show up in the listing, but adding documents (both documents and methods) has no effect. If I delete the *original* documents created by the installation, they show up as being gone, but even a copy-paste of the original documents doesn't get any new documents/methods etc. to show up.
Am I doing a dumb newbie thing here? (I *do* have a folder called 'subFolder' btw).
many thanks tone ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Tony's problem was that Zope was correctly respecting the meta_type of the 'old' Document objects included with the demo, but any new documents added afresh were being created with the 'DTML Document' or 'DTML Method' meta-types, which were falling through the objectValues 'sieve'.
Andy, Thank you *very* much for this - I thought I was losing my marbles over it! (Now all I need is links to External Files and I'm away! :) Thanks again, tone. ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
On Tue, 9 Mar 1999, Tony McDonald wrote:
add folders and delete them and the changes made show up in the listing, but adding documents (both documents and methods) has no effect. If I delete the *original* documents created by the installation, they show up as being gone, but even a copy-paste of the original documents doesn't get any new documents/methods etc. to show up.
My guess is that you created your original database in Zope-1.9 and then moved everything into Zope-1.10. If that is the case then you need to replace <!--# in "objectValues(['Document'])"--> with <!--# in "objectValues(['Document','DTML Document','DTML Method'])"--> or something to that effect. Pavlos
participants (4)
-
Andy Smith -
Butch Landingin -
Pavlos Christoforou -
Tony McDonald