[Zope] dtml-with in python script

Chris Kratz chris.kratz@vistashare.com
Wed, 20 Jun 2001 16:19:24 -0400


Hello all,

Folder structure is like this

root
  |-SharedCode
  |      |- CodeSnippet
  |-Folder a
         |-Folder 1
                |-Folder A

I put pieces of code we use across the whole website in Shared code.  If I
want to get CodeSnippet I use the following code in DTML.

<dtml-with SharedCode>
   <dtml-var CodeSnippet>
</dtml-with>

Now, how do I do this in a python script?  There doesn't seem to be an
equivalent command like dtml-with to push a folder onto the namespace.  And
getitem doesn't support getting objects that are not in the namespace.
Help!!

Things I have tried (among many)

_['SharedCode']['CodeSnippet'] - Returns Code Snippet, but all " are
returned as &quot;, I need "
_.getitem('CodeSnippet',1) - Doesn't work, not in namespace.
_.getitem(_['SharedCode']['CodeSnippet'], 1) - Doesn't work
_['SharedCode'].getitem(... doesn't work because getitem is associated with
the _ namespace.
etc, etc, etc

-Chris