[Zope] How can folder address its contents?

Robert W. Erb rerb@progress.com
12 Dec 1999 17:11:43 -0500


Stephen -

First, thanks for the help.

I'm lost.  I created a DTML Document in a folder called "eScream".
The whole contents of this document are:

<dtml-in use_cases>
  <dtml-var "_['sequence-item'].id">
</dtml-in>

There's a folder called use_cases in the current folder.  In
use_cases, there are a bunch of DTML Methods.

When I run the code above, I get this error:

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

So I'm thinking maybe I'm too far gone.  Maybe I don't know
what I thought I knew I thought about.

Here's the traceback.  Any ideas?

Traceback (innermost last):
  File D:\PROGRA~1\pcrerb\lib\python\ZPublisher\Publish.py, line 214, in publish_module
  File D:\PROGRA~1\pcrerb\lib\python\ZPublisher\Publish.py, line 179, in publish
  File D:\PROGRA~1\pcrerb\lib\python\Zope\__init__.py, line 201, in zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File D:\PROGRA~1\pcrerb\lib\python\ZPublisher\Publish.py, line 165, in publish
  File D:\PROGRA~1\pcrerb\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: test2)
  File D:\PROGRA~1\pcrerb\lib\python\ZPublisher\Publish.py, line 102, in call_object
    (Object: test2)
  File D:\PROGRA~1\pcrerb\lib\python\OFS\DTMLDocument.py, line 166, in __call__
    (Object: test2)
  File D:\PROGRA~1\pcrerb\lib\python\DocumentTemplate\DT_String.py, line 502, in __call__
    (Object: test2)
  File D:\PROGRA~1\pcrerb\lib\python\DocumentTemplate\DT_In.py, line 672, in renderwob
    (Object: use_cases)
  File D:\PROGRA~1\pcrerb\lib\python\OFS\ObjectManager.py, line 538, in __getitem__
    (Object: ElementWithAttributes)
  File D:\PROGRA~1\pcrerb\lib\python\OFS\ObjectManager.py, line 218, in _getOb
    (Object: ElementWithAttributes)
TypeError: (see above)


Stephen Pitts <smpitts@midsouth.rr.com> writes:

> On Sun, Dec 12, 1999 at 02:06:38PM -0500, Robert W. Erb wrote:
> > I want to iterate over the contents of a folder.  I can't do it by
> > name, since items will be added and taken out of the folder at run
> > time, so I don't know what they'll be called.
> > 
> > I think I'll figure out the iteration ok, but how do I get at the
> > objects contained in a folder, other than by name?
> > 
> 
> Something like this should work.
> <dtml-in objectItems>
> <dtml-var "_['sequence-item'].title">
> </dtml-in>
> 
> Beware of the sequence-item snafu; to use it in expressions, you must
> refer to it as _['sequence-item']! Anyone know why this is?
> -- 
> Stephen Pitts
> smpitts@midsouth.rr.com
> webmaster - http://www.mschess.org

-- 
. . . . . . . . . . . . . . . .
.
. Bob Erb 
.
. I don't want to die today!