[Zope] <dtml-with> Question

Phil Harris phil@philh.org
Sun, 10 Oct 1999 22:33:10 +0100


I solved this by creating an external method and using eval/exec to get the
object specified in the string, then passing the result back into dtml.

HTH

Phil
phil@philh.org

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Kevin
Dangoor
Sent: 10 October 1999 20:37
To: Sascha Matzke
Cc: zope@zope.org
Subject: Re: [Zope] <dtml-with> Question


-----Original Message-----
From: Sascha Matzke <sascha@bespin.de>
To: Kevin Dangoor <kid@kendermedia.com>
Cc: zope@zope.org <zope@zope.org>
Date: Sunday, October 10, 1999 2:29 PM
Subject: Re: [Zope] <dtml-with> Question


>Hallo,
>
>On Sun, Oct 10, 1999 at 02:16:12PM -0400, Kevin Dangoor wrote:
>> It sounds like you're basically trying to do a namespace lookup.
>>
>> <dtml-with "_[objA]">
>> should do what you want.
>
>It doesn't...
>
>I have an variable named item with the value "Desk.Test.index_html".

Aha. That is more complex.

I don't know if this is the BEST way to do what you want, but you could do:

<dtml-call "REQUEST.set('objnames', _.string.split(item, '.'))">
<dtml-with "_[objnames[0]]">
<dtml-with "_[objnames[1]]">
<dtml-with "_[objnames[2]]">
...your other stuff...

</dtml-with>
</dtml-with>
</dtml-with>

Kevin


_______________________________________________
Zope maillist  -  Zope@zope.org
http://www.zope.org/mailman/listinfo/zope

(Related lists - please, no cross posts or HTML encoding!

To receive general Zope announcements, see:
http://www.zope.org/mailman/listinfo/zope-announce

For developer-specific issues, zope-dev@zope.org -
http://www.zope.org/mailman/listinfo/zope-dev )