[Zope] How can folder address its contents?

Jeff K. Hoffman jkhoffman@carolina.rr.com
Sun, 12 Dec 1999 16:54:59 -0500 (EST)


On Sat, 11 Dec 1999, Phil  Harris wrote:

> Try something like
> 
> <dtml-in foldername>
>   <dtml-var id>
> <dtml-else>
>   Nothing in folder.
> </dtml-in>

I just tried this on my Zope and, unless I did something wrong, it did not
work. It failed with:

  Error Type: TypeError
  Error Value: hasattr, argument 2: expected string, int found

What has always worked for me is:

  <dtml-in "foldername.objectValues()">
    <dtml-var id>
  <dtml-else>
    Nothing in folder.
  </dtml-in>

If you want only the folders contained in foldername:

  <dtml-in "foldername.objectValues(['Folder'])">
  ...
  </dtml-in>

If you want folders and DTML Methods:

  <dtml-in "foldername.objectValues(['Folder', 'DTML Method'])">
  ...
  </dtml-in>

And so on.

--Jeff