Parametera and Formulator
Hi, I have two questions today, both concerning the not so clearly explained parameter passing of Zope: 1. Did I understand it right when I assume that all the variables (form and dtml-let stuff) are available in all the objects that are below (in the object hierarchy) the one where they were defined. 2. How do I pass one of these Global (?) variables to a python procedure from a DTML page ? BRGDS -- Dag Nygren email: dag@newtech.fi Oy Espoon NewTech Ab phone: +358 9 8024910 Träsktorpet 3 fax: +358 9 8024916 02360 ESBO Mobile: +358 400 426312 FINLAND
Dag Nygren wrote:
I have two questions today, both concerning the not so clearly explained parameter passing of Zope: 1. Did I understand it right when I assume that all the variables (form and dtml-let stuff) are available in all the objects that are below (in the object hierarchy) the one where they were defined.
For the most part, yes.
2. How do I pass one of these Global (?) variables to a python procedure from a DTML page ?
You mean a Script (Python)? Go to the Bindings tab and bind 'namespace' to _. Then you can do: myvar = _['myvar'] ...and so on. cheers, Chris
Dag Nygren writes:
I have two questions today, both concerning the not so clearly explained parameter passing of Zope: There are few special things with parameter passing...
1. Did I understand it right when I assume that all the variables (form and dtml-let stuff) are available in all the objects that are below (in the object hierarchy) the one where they were defined. No.
You should probably read the "Name lookup" section of <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Object hiearchy and "dtml-let" are orthogonal. "REQUEST" (and its components like "form") are global in one request.
2. How do I pass one of these Global (?) variables to a python procedure from a DTML page ? You use acquisition to access REQUEST, e.g. by "container.REQUEST".
You use acquisition to access attributes (properties and methods) of objects, e.g. "context.some_parent.title". You either pass dtml variables explicitely or bind the DTML namespace (--> "Bindings tab"). Then use "_['your_dtml_variable']". Dieter
participants (3)
-
Chris Withers -
Dag Nygren -
Dieter Maurer