[Zope] Re: Dynamically Accessing Folders
James W. Howe
jwh@allencreek.com
Wed, 20 Oct 1999 16:40:48 -0400
Thanks to all who helped me with my question about how to dynamically
iterate over subfolders in order to invoke a method in each of the
subfolders. I have one more thing that I want to be able to do with this
code. I currently have a structure which is something like this:
Folder A
iterate (DTMLMethod)
Folder B
myName (DTMLMethod)
Folder C
myName (DTMLMethod)
At the present time, no matter where I invoke the "iterate" method, I get a
list of the results of invoking "myName" for Folders B and C. What I want
to be able to do is tailor the results depending on were the iterate method
was invoked. For example, if I invoke the method from
http://localhost/FolderA/FolderB/iterate the results might be:
Folder B - I'm selected!
Folder C
but if I invoke it from Folder C the results might be:
Folder B
Folder C - Pick from below:
Item1
Item2
What I would like to be able to do is invoke "myName" with a parameter
which would indicate who is the invoker of "iterate". The pseudo-code for
"myName" might be something like:
<dtml-if sender = ??myself??>
<dtml-var fullContents>
<dtml-else>
<dtml-var simpleContents>
<dtml-endif>
The "iterate" DTMLMethod (defined in FolderA) would be defined loosely as
follows:
<dtml-with FolderA>
<dtml-in "objectValues(['Folder'])">
<dtml-var "myName(sender=???)">
</dtml-in>
</dtml-with>
What I'm trying to do is create a set of methods which reside up at the
"FolderA" level and where the subfolders only have to implement the
"fullContents" and "simpleContents" DTML Methods.
Is there a way for me to do this?
Thanks.
James W. Howe mailto:jwh@allencreek.com
Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103