[Zope] DTML Doc property from DTML Method in tag
Amos Latteier
amos@aracnet.com
Wed, 17 Feb 1999 10:34:20 -0800
At 06:28 PM 2/15/99 -0500, Kevin Dangoor wrote:
>On Mon, Feb 15, 1999 at 01:30:51PM -0800, Amos Latteier wrote:
>| <!--#in ids-->
>| <!--#var "_[_['sequence-item']].common_name"-->
>| <!--#/in-->
>
>Hmm. This doesn't seem to work for me, and it is (I think) essentially
>the same situation.
>
>I have a Folder with a lines property that contains ids of DTML Documents.
>
>Within my #in tags:
><!--#var sequence-item-->
>will display "test" (which is the ID of my document)
><!--#var test.title-->
>will display the title of that document
><!--#var "_[_['sequence-item']].title"-->
>gives me an attribute error.
>
>I just tried this again, but using a Folder instead of a DTML Document.
>This works for the Folder, but not for the DTML Doc. Is this a bug in the
>DTML Document, or am I missing something?
My bad! This is what I meant to say:
<!--#var "_.getitem(_.getitem('sequence-item')).title"-->
I did not understand the difference between _[] and _.getitem. The DTML
User's Guide explains that _[] automatically calls objects, while _.getitem
does not by default.
So the reason you were getting an attribute error is that Zope was calling
the Documents and then looking for a 'title' attribute in the resulting
string.
time-for-me-to-reread-the-dtml-users-guide-ly yrs,
-Amos