Looping through a folder's contents...
I would like to loop through the contents of a folder, and the contents of the subfolders of that folder. I know I can do this to a singular level by doing something like: <dtml-in "subfolder.objectValues('Folder')"> <dtml-var title> </dtml-in> Should give me a list of the titles of all the subfolders of the folder called "subfolder". So, once I get there, how do I loop through the subobjects of each of those folders? In other words, I have a subfolder inside of the folder called "subfolder" and I want to see the contents of that folder. How do I do it? -- IBM Pollyanna Principle: Machines should work. People should think.
+-------[ jiva@devware.com ]---------------------- | I would like to loop through the contents of a folder, and the | contents of the subfolders of that folder. I know I can do this to a | singular level by doing something like: | | <dtml-in "subfolder.objectValues('Folder')"> | <dtml-var title> | </dtml-in> | | Should give me a list of the titles of all the subfolders of the | folder called "subfolder". So, once I get there, how do I loop | through the subobjects of each of those folders? | | In other words, I have a subfolder inside of the folder called | "subfolder" and I want to see the contents of that folder. How do I | do it? I'll give you the general case for 'all' folders:- Make a Method... Recurse_SubFolder. <dtml-in "root.objectValues('Folder')"> <dtml-in "_.range(depth)"> </dtml-in><dtml-var title> <dtml-var "Recurse_SubFolder(root=this(),depth=depth+1)"> </dtml-in> --------- <dtml-var "Recurse_SubFolder(root=subfolder, depth=0)"> You can obviously expand this to also take a 'type' for objectValues, and pass the namespace etc. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
What would the "Recurse_Subfolder" method do? On Mon, Aug 21, 2000 at 04:12:05PM +1000, Andrew Kenneth Milton wrote:
+-------[ jiva@devware.com ]---------------------- | I would like to loop through the contents of a folder, and the | contents of the subfolders of that folder. I know I can do this to a | singular level by doing something like: | | <dtml-in "subfolder.objectValues('Folder')"> | <dtml-var title> | </dtml-in> | | Should give me a list of the titles of all the subfolders of the | folder called "subfolder". So, once I get there, how do I loop | through the subobjects of each of those folders? | | In other words, I have a subfolder inside of the folder called | "subfolder" and I want to see the contents of that folder. How do I | do it?
I'll give you the general case for 'all' folders:-
Make a Method... Recurse_SubFolder.
<dtml-in "root.objectValues('Folder')"> <dtml-in "_.range(depth)"> </dtml-in><dtml-var title> <dtml-var "Recurse_SubFolder(root=this(),depth=depth+1)"> </dtml-in>
<dtml-var "Recurse_SubFolder(root=subfolder, depth=0)">
You can obviously expand this to also take a 'type' for objectValues, and pass the namespace etc.
-- A homeowner's reach should exceed his grasp, or what's a weekend for?
+-------[ jiva@devware.com ]---------------------- | What would the "Recurse_Subfolder" method do? | | > <dtml-in "root.objectValues('Folder')"> | > <dtml-in "_.range(depth)"> </dtml-in><dtml-var title> | > <dtml-var "Recurse_SubFolder(root=this(),depth=depth+1)"> | > </dtml-in> That *is* Recruse_Subfolder :-) -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
Hello oops!.. I just tried this and now I am getting error messages saying "not authorized" to access 'objectValues' - stranger yet seems to have broken my login to Zope - so I am locked out from even getting back into the site to fix ..hmm this can't be right. I had put the Recurse_SubFolder method at top level, hoping to use it liberally through the site. I then made a call to it from my site's root index_html Any ideas how to restore my Zope? TIA - Jason ----- Original Message ----- From: Andrew Kenneth Milton <akm@mail.theinternet.com.au> To: <jiva@devware.com> Cc: <zope@zope.org>; <zope-dev@zope.org> Sent: Monday, August 21, 2000 2:12 AM Subject: Re: [Zope] Looping through a folder's contents...
+-------[ jiva@devware.com ]---------------------- | I would like to loop through the contents of a folder, and the | contents of the subfolders of that folder. I know I can do this to a | singular level by doing something like: | | <dtml-in "subfolder.objectValues('Folder')"> | <dtml-var title> | </dtml-in> | | Should give me a list of the titles of all the subfolders of the | folder called "subfolder". So, once I get there, how do I loop | through the subobjects of each of those folders? | | In other words, I have a subfolder inside of the folder called | "subfolder" and I want to see the contents of that folder. How do I | do it?
I'll give you the general case for 'all' folders:-
Make a Method... Recurse_SubFolder.
<dtml-in "root.objectValues('Folder')"> <dtml-in "_.range(depth)"> </dtml-in><dtml-var title> <dtml-var "Recurse_SubFolder(root=this(),depth=depth+1)"> </dtml-in>
---------
<dtml-var "Recurse_SubFolder(root=subfolder, depth=0)">
You can obviously expand this to also take a 'type' for objectValues, and pass the namespace etc.
-- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
_______________________________________________ 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 )
+-------[ Jason Cunliffe ]---------------------- | Hello | | oops!.. I just tried this and now I am getting error messages saying "not | authorized" to access 'objectValues' - stranger yet seems to have broken my | login to Zope - so I am locked out from even getting back into the site to | fix ..hmm this can't be right. It's probably real busy traversing your entire site right now... Control Panel, acl_users, *everything* | I had put the Recurse_SubFolder method at top level, hoping to use it | liberally through the site. I then made a call to it from my site's root | index_html Yep see above. You kamikaze you. You are a bad bad puppy. | Any ideas how to restore my Zope? Probably just restarting it will do the trick nicely. Then you will be modifying the method to return if the depth exceeds say 5. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
+-------[ Jason Cunliffe ]---------------------- | Hello | | oops!.. I just tried this and now I am getting error messages saying "not | authorized" to access 'objectValues' - stranger yet seems to have broken my | login to Zope - so I am locked out from even getting back into the site to | fix ..hmm this can't be right.
It's probably real busy traversing your entire site right now... Control Panel, acl_users, *everything*
| I had put the Recurse_SubFolder method at top level, hoping to use it | liberally through the site. I then made a call to it from my site's root | index_html
Yep see above. You kamikaze you. You are a bad bad puppy.
| Any ideas how to restore my Zope?
Probably just restarting it will do the trick nicely.
Then you will be modifying the method to return if the depth exceeds say
Andrew, You *almost* seem to be enjoying this ;) ----- Original Message ----- From: "Andrew Kenneth Milton" <akm@mail.theinternet.com.au> To: "Jason Cunliffe" <jasonic@nomadicsltd.com> Cc: "Andrew Kenneth Milton" <akm@mail.theinternet.com.au>; <zope@zope.org> Sent: Monday, August 21, 2000 3:26 PM Subject: Re: [Zope] Looping through a folder's contents... 5.
-- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew
Milton
The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
_______________________________________________ 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 )
+-------[ Phil Harris ]---------------------- | Andrew, | | You *almost* seem to be enjoying this ;) Until I get sued for code I paste to a mailing list.... d8) The day will come, mark my words, that someone will get sued for trying to help. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
participants (4)
-
Andrew Kenneth Milton -
Jason Cunliffe -
jiva@devware.com -
Phil Harris