[Zope] Getting the contents of an acquired dtml method in a python script

Dieter Maurer dieter@handshake.de
Sun, 14 Apr 2002 23:40:42 +0200


Howard Hansen writes:
 > I'm sure this is something simple, but none of my searches have uncovered
 > the magical sequence.
 > 
 > I've got several sites running from a single Zope folder.  Some of the
 > content and much of the functionality is shared among the different states.
 > Each state folder contains dtml methods containing state-specific
 > information (abbreviation, the id number used in the database, etc.)
 > 
 > My script needs to get the contents of the abbreviation method for some URL
 > munging, and I can't for the life of me figure out how to get it via script.
Not sure, what you mean with content...

You access the DTML object (usually) through acquisition via "context":

    context.myDTMLObject

When you are interested in its source, you call its "document_src"
method:

    context.myDTMLObject.document_src()

When you want the rendered result, you call your DTML object:

    context.myDTMLObject(context,context.REQUEST)

When you are interested in background information,
please read

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>



Dieter