[Zope] Indirect variable references
Ross J. Reedstrom
reedstrm@rice.edu
Wed, 03 Mar 1999 18:02:51 -0600
Amos Latteier wrote:
<a nice dissertation on variable indirection, which I now understand>
I'm piggy backing this on Amos's post from a while ago, because that is
where I finally found my answer. I could have sworn I had seen (and
used!) a DTML code fragment that displayed the form variables sent to
it, with there values. Obviously, this involves indirection.
After hunting through my (extensive) zope-list archive, I couldn't find
it, so I started over, with the help of Amos's text and wrote one. I
often need little tools like this to debug between my forms and sql
actions, so I can see what's really going on!
I call it 'show_vars'
The only tricky thing in it is that sequence-item is an invalid variable
name, so I need to wrap it in _[''] which leads to the double wrap when
dereferencing to get the value. Anyway, hope someone else finds it
useful!
<!--#var standard_html_header-->
<table border=2>
<th>Form Variable</th><th>Value</th>
<!--#in "REQUEST.form.keys()"-->
<tr><td><!--#var sequence-item--></td>
<td><!--#var "_[_['sequence-item']]"--></td></tr>
<!--#/in-->
</table>
<!--#var standard_html_footer-->
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005