[Zope] Evaluating Output of Scripts as HTML in DTML Pages

Samir Mishra SamirMishra@cbuae.gov.ae
Tue, 25 Mar 2003 12:16:59 +0400


Hello all,

I'm not even sure where I can look for the answer to this problem.

I have a SQL table with a large number of variables. I have a data entry
form that uses the following logic about 30 times on a page - 
----------------------------
<dtml-let a=RA3_4 b=NRA3_4 t=TOT3_4>
<tr>
  <td />
  <td>3.4</td>
  <td class="row-label">
  <dtml-if "a+b==t"><span>
  <dtml-else><span class="error">
  </dtml-if>
  Cheques in System</span></td>
  <td><input type="text" dir="rtl" name="RA3_4"  value="<dtml-var a>"
size="12" maxlength="12" /></td>
  <td><input type="text" dir="rtl" name="NRA3_4" value="<dtml-var b>"
size="12" maxlength="12" /></td>
  <td><input type="text" dir="rtl" name="TOT3_4" value="<dtml-var t>"
size="12" maxlength="12" /></td>
</tr>
</dtml-let>
---------------------------

What I'd like to be able to do is create a Python script that returns the
above, AND I need the DTML document to recognise it as part of the code. The
above code snippet would be generated by a script, called as -

myParseDTML("3.4","Cheques in System", "RA3_4","NRA3_4", "TOT3_4")

This script would return the above code. My problem is, I can generate the
above code, but it's not evaluated within a DTML Method.


As a simple example, I have the following python script -
-------------
""" script name - testScript """
text="""
<dtml-var standard_html_header>
<dtml-var standard_html_footer>
"""
return text
-------------

How do I get the return value of this script to actually display the above
items in a DTML Method? 

(I hope I've explained this well)

Thanks in advance. Any help will be greatly appreciated.

Samir.