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. That is not the case here. It now operates on something else: the Python script, or the return value of the Python script. My first question is: Is this correct, is this why dm2 fails to recognize other dtml variables, defined in the same folder ? My second question is: what to do about this ? thanks, Marc Marc de Kamps - Neuro-IT.net e-mail: kamps@in.tum.de tel: 0049-89-28918128
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
participants (3)
-
Kevin Carlson -
Maik Jablonski -
Marc de Kamps