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

Passin, Tom tpassin@mitretek.org
Tue, 25 Mar 2003 10:22:35 -0500


[ Samir Mishra]
> I have a SQL table with a large number of variables. I have a=20
> data entry
> form that uses the following logic about 30 times on a page -=20
> ----------------------------
[snipped]
> ---------------------------
>=20
> What I'd like to be able to do is create a Python script that=20
> returns the
> above, AND I need the DTML document to recognise it as part=20
> of the code.

You should not be using Python to write markup.  You should have Python
compute and return parameters to a DTML method which would then
constrcut the form you want.  This division of labor will work much
better, and be easier to understand and maintain, than getting Python to
write the markup directly (which certainly can be done, but is best not
done).

For example, the Python script could return a dictionary of values,
which your DTML method would insert into your form template.

Cheers,

Tom P