[Zope] dtml-in --> sequence

Andrew Williams ajwms@hotmail.com
Fri, 6 Apr 2001 12:27:42 -0400


----- Original Message -----
From: "After Dark" <afterz@zipmail.com>
To: "Andrew Williams" <ajwms@hotmail.com>; "After Dark"
<afterz@zipmail.com>; <zope@zope.org>
Sent: Friday, April 06, 2001 12:04 PM
Subject: Re: [Zope] dtml-in --> sequence


> 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>

ok.. that means what you are getting back from your <dtml-in ..> is a
string; strings don't have id objects.
>
> 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?

Check out the API Reference for more info;

List of objects in current folder returning objects (sequence-item is the
actual object):

<dtml-in "objectValues()">
  The ID of this object is: <dtml-var expr="_['sequence-item'].id">
</dtml-in>


List of objects in current folder returning id (sequence-item is a string
containing the objects id):

<dtml-in "objectIds()">
  ID=<dtml-var expr="_['sequence-item']">
</dtm-in>


Now, sequence-item in the first example is a reference to an actual object;
sequence-item in the second example is a string containing the id.

If you already have the object, you don't need do perform a _.getitem()
*However* if you only have the string with the object name (ie: id), then
you need to perform a _.getitem()

Does this help?


Andrew