[Zope] Re: dtml question

Maik Jablonski maik.jablonski at uni-bielefeld.de
Fri Sep 19 12:02:04 EDT 2003


Marc de Kamps wrote:
> Greetings,
> 
> I have a folder, containing dtml method1  (dm1), python script (ps) and dtml
> method 2 (dm2).
> 
> - dtml method1 contains a form, which calls ps. arguments of ps are the
> information collected
>   in the text inputs of dm1. Works fine.
> 
> - ps processes the argument and depending on the values, does nothing or
> calls
>   dm2, with the statement: return context.dm2(name_value=name)
> 
> - Hence if I use <dtml-var name_value> in dm2, I expect it to have the
> value: name, and it does.
> 
> I tried to use other dtml variables, which are defined in the same folder,
> however in dm2, and
> they were all undefined. This puzzled me.
> 
> After reading the Zope book, my interpretation of events is that a dtml
> method typically is
> called inside other dtml methods and then operates on the folder, from which
> it is called.
...

Zope-Book (2.6) says:

http://zope.org/Documentation/Books/ZopeBook/2_6Edition/AdvDTML.stx

""" Calling a DTML object from a Python Script

Although calling a DTML method from a Python script isn't really an 
advanced DTML technique, it deals with DTML, so it's being included 
here. To call a DTML Method or DTML Document from a Python script, the 
following code is used:

dtmlMethodName = 'index_html'
return context[dtmlMethodName](container, container.REQUEST)

It's as simple as that. Often this is very useful if you wish to forward 
a request and significant processing is needed to determine which dtml 
object is the target.
"""

Two FAQs (in German, maybe you can read them, because your mail is from 
germany):

http://www.dzug.org/SchreibMit/ZopeFaq/DTML/dtml_aufrufen
http://www.dzug.org/SchreibMit/ZopeFaq/DTML/dtml_context

HTH,

Maik





More information about the Zope mailing list