[Zope] Calling DTML after executing sa script
Passin,Thomas B. (Tom)
tpassin@mitretek.org
Thu, 12 Sep 2002 17:39:48 -0400
[ Mark Roach]
> On Wed, 2002-09-11 at 21:23, michael.ta=F1ag wrote:
> >=20
> > How do you call a DTML method/document after you have executed a=20
> > python script? Can you also pass some values to this DTML=20
> > document/method from the script?
> >=20
>=20
> Hello, michael. What I have done is to put:
> return context.dtmlMethod()
>=20
> at the end of my script. If you just want to pass along the=20
> request received by the script you can do : return=20
> context.dtmlMethod(context, context.REQUEST)
>=20
> you can also pass named parameters with:
> return context.dtmlMethod(context, context.REQUEST,paramname=3Dvalue)
>=20
However, I do not recommend calling dtml from a script at all, even =
though it can be done. What you should do, IMHO, is to return values =
from the script to the caller (probably a DTML document or method, in =
this case), and then that caller can handle any further calls to other =
dtml methods. =20
This approach keeps Python processing separate from dtml processing, =
which is GOOD. Mixing them up tends to lead to later confusion or =
obscure problems. It could (potentially at least) also cause unreleased =
resources, possibly leading to long-term memory leaks.
For example, if you use a Python script to compute parameters for a =
database query, do not call a zsql method from the script. Instead, =
return the parameters to the calling dtml document and call the zsql =
method from the document instead.
Cheers,
Tom P