[Zope] dtml-echo?

Tony McDonald tony.mcdonald@ncl.ac.uk
Wed, 15 Mar 2000 08:43:35 +0000


At 12:51 pm -0600 14/3/00, jessica lee tishmack wrote:
>Thanks for the reference to the DTML Guide...it has helped a lot.  I have
>come across something that I couldn't seem to find an answer to.  I have
>the following line in my original code that I uploaded from an
>existing HTML directory...I can't seem to find a dtml tag that will
>replace the echo statements here...
>
>href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80/
><!--#echo var="><!--#echo var="REQUEST_URI" -->;weblint"

Normally I'd say try,

href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 
/<dtml-var "REQUEST['REQUEST_URI']">;weblint"
(the new Zope syntax is <dtml-XXX, but you can use <!--#var XXX--> if you want.

But that doesn't work as REQUEST_URI gives a KeyError.
This is weird because other REQUEST variables seem to work. Any deep 
voodoo Zopistas know why?

<dtml-in "REQUEST.items()">
<dtml-var sequence-key> : <dtml-var sequence-item> <br>
</dtml-in>

Hint:
To see all the REQUEST variables tack on /REQUEST to any URL you have 
(only works with Zope < 2.1.4) or put this in a dtml document
<dtml-var REQUEST>

To just get the environment variables;
<dtml-in "REQUEST.environ.items()">
<dtml-var sequence-key> : <dtml-var sequence-item> <br>
</dtml-in>

So your code should work if you do this;
href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 
/<dtml-var "REQUEST.environ['REQUEST_URI']">;weblint"

(If this seems long winded, it's because I'm writing this as I figure 
it out! :)

Hint: Remember that anything inside "..." is a Python expression and 
Python, *not* Zope syntax applies.

>I found this snippet of code for an echo and set, but my attempts at
>modifying it to work for this have failed.
>
><!--#call "REQUEST.set('varName', 'varValue')"-->
><!--#var varName-->

That should work fine.

hth
Tone.
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2