[Zope] Referencing Objects from id's stored in a lines property. -- Another Update

complaw@hal-pc.org complaw@hal-pc.org
Thu, 16 Aug 2001 23:32:37 GMT


I'm considering using a DTML document having a lines property that stores 
id's of related objects (i.e., objects where there is to be a user-defined
relation).  Essentially, the lines property would be a container of id's of
objects available to the object having the lines container.  

I can load the id's into the lines property (that is easy).  However, does
anyone know of the DTML code needed to sequentially list each of the elements 
in the lines property (which is a Python list) and then call that object to 
obtain and then display the title corresponding to the object id?

The following code works...

<P>Here they are, one by one.<BR>
<dtml-in cases>
  <A HREF="<dtml-var sequence-item>"><dtml-var sequence-item></A><BR>
</dtml-in>

But the above code only lists the id's, not the titles to the id's (which 
would be easier for the user to understand).
 
I tried this...

<P>Here they are, one by one.<BR>
<dtml-in my_related_objects>
  <A HREF="<dtml-var sequence-item>"><dtml-var expr="getattr(sequence-item, 
'title')"></A><BR>
</dtml-in>


.. but got a parsing error.

Then I tried this...

<P>Here they are, one by one.<BR>
<dtml-in cases>
  <A HREF="<dtml-var sequence-item>">
    <dtml-let my_id=sequence-item>
      <dtml-in objectValues(my_id)>
        <dtml-var title>
      </dtml-in>
    </dtml-let>
  </A><BR>
</dtml-in>

.. but that didn't work either.


Does anyone know what I did wrong?  Is there a better way to do this?

Thanks again,

Ron