[Zope] Re: DTML Doc property from DTML Method in tag

Martijn Pieters mj@atmm.nl
Tue, 16 Feb 1999 10:25:37 +0100


As I don't trust the eGroups interface as far as I can throw it, here is my
message again:

Kevin, this is what you want to do:

<!--#in docs-->
    <P><!--#with expr="_.getitem(_['sequence-item'], 0)"-->
        <!--#var title-->
    <!--#/with--></P>
<!--#/in-->

_.getitem() retrieves an item from the namespace, given the id of the item.
Just _.getitem(sequence-item, 0) won't do, because it is interpreted as
sequence - item, so you have to use the _['sequence-item'] construct.
Within the with tag you are then within the namespace of the requested
object, so <!--#var title--> gives you the right title.
You might want to use _.has_key(_['sequence-item']) first, to check wether
the object actually exists..

_.getitem() has a second argument BTW, a flag that specifies wether or not
the retrieved object should be 'called'. I think that in this context it
should be 0, i.e. don't call the object. I assume it otherwise retrieves
the default representation of the item, like a folder's index_html, which
you don't want to do probably. I haven't experimented with this flag as yet.

Martijn Pieters, Zope Expert of 3 days.

--
M.J. Pieters, Web Developer
| ATMM http://www.atmm.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@atmm.nl http://www.atmm.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------