[Zope] A Method To My Madness?
Oleg Broytmann
Oleg Broytmann <phd@phd.pp.ru>
Sat, 8 Sep 2001 21:33:01 +0400
On Sat, Sep 08, 2001 at 09:45:57AM -0700, Ben Ocean wrote:
> <dtml-in expr="objectValues('DTML Document')">
> <li><a href="&dtml-absolute_url;"><dtml-var title_or_id></a></li><br>
> </dtml-in>
>
> Pretty straight-forward stuff, but strangely it works within DTML Methods
> but *not* within DTML Documents. Other DTML Methods work just fine. What am
> I doing wrong?
Nothing. You do it all right, but you forgot that Documents and Methods
have different namespace rules. A Method does not have its own namespace,
so objectValues is applied to its (the Method's) container.
But a Document has its own namespace, so objectValues is applied to the
Document itself! And there is no subobjects to list by objectValues, so you
got nothing.
Inside DTML Document you would write
<dtml-in expr="PARENTS[-1].objectValues('DTML Document')">
thus listing objects in Document's parent (e.i. its container).
Oleg.
----
Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.