RE: [Zope] Calling DTML after executing sa script
[ Mark Roach]
On Wed, 2002-09-11 at 21:23, michael.taƱag wrote:
How do you call a DTML method/document after you have executed a python script? Can you also pass some values to this DTML document/method from the script?
Hello, michael. What I have done is to put: return context.dtmlMethod()
at the end of my script. If you just want to pass along the request received by the script you can do : return context.dtmlMethod(context, context.REQUEST)
you can also pass named parameters with: return context.dtmlMethod(context, context.REQUEST,paramname=value)
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. 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
participants (1)
-
Passin,Thomas B. (Tom)