[Zope] dtml-in --> sequence

Casey Duncan cduncan@kaivo.com
Fri, 06 Apr 2001 10:21:21 -0600


After Dark wrote:
> 
> I made this, but gave the following error: string object
> does not have id atribute...
> <P>Object ID = <dtml-var expr="_['sequence-item'].id"></P>
> 
> Because I need the id from sequence-item, I tryed
> _['sequence-var-id'] but didn`t work. I even tryed
> _.getitem(['sequence-item']).id
> 
> Do you know how to make it works?
> 
> By.
> 

You are sooo close.

You cannot use _['sequence-item'].id because _[] calls the object if it
is callable, which results in a string for DTML objects.

If you are in a dtml-in loop, there is no need to dereference
sequence-item explicitly, dtml-in already puts all of its attributes on
the namespace inside the loop.

<dtml-in "Folder.objectValues()">
  <P>Object ID = <dtml-var name="id"></P>
</dtml-in>

will suffice, however it is overkill, the following is more efficient:

<dtml-in "Folder.objectIds()">
  <P>Object ID = <dtml-var name="sequence-item"></P>
</dtml-in>

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>